Unitech / Unitech/pm2

Express app becomes unreachable via pm2, works fine running directly

Open
#5,653 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Providing a repro for this is sadly hard due to the Express app being huge, but the gist of the problem is that:

  1. When running the app directly (node index.js), it works perfectly fine and responds to API requests in browser/postman.
  2. When running via PM2, it becomes unreachable - it is still running correctly, with logs indicating no runtime errors. HOWEVER, all API requests terminate immediately in browser/postman with ECONNREFUSED state, and the app logs indicate no incoming requests whatsoever.

Where can we even start to debug this? Our only conclusion is that the error must occur somewhere in PM2 itself, but there are no useful errors or anything else being thrown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Express app launched with node index.js against the same app launched through PM2, using browser or Postman API requests and the PM2 application logs. The issue provides no reproducible project, PM2 command, or named test; done would mean identifying why the PM2-managed process refuses requests and documenting or fixing a reproducible cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
api, backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.