Node.js Express container stops automatically with SIGTERM
aspireengginfo-cpu
HOBBYOP

a month ago

Hi Railway Team,

I am using a Node.js/Express backend on the Hobby plan.

My service starts successfully, connects to MongoDB, and responds with HTTP 200, but shortly afterward the container is stopped automatically.

Relevant logs:

Cron jobs initialized.

Server running in production mode on port 8080

API available at http://localhost:8080/api/v1

MongoDB Connected

GET / HTTP/1.1 200

Stopping Container

npm error path /app

npm error command failed

npm error signal SIGTERM

npm error command sh -c node src/server.js

My backend also has scheduled cron jobs running inside the Node.js process.

Serverless is OFF.

Because the container stops, my production API becomes unavailable and my frontend starts showing network errors.

Please investigate why the ACTIVE/RUNNING container is receiving SIGTERM after it has successfully started.

Could you please check the Railway-side termination reason and confirm whether this is caused by:

  • Railway infrastructure
  • resource limits
  • deployment replacement
  • healthcheck
  • restart policy
  • Hobby plan restrictions
  • cron/background process behavior
  • or any other Railway-side condition

Please check the internal container/deployment logs and tell me the exact reason for the SIGTERM.

I have already redeployed the service and the issue still occurs.

Thank you.

$10 Bounty

4 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 1 month ago


Is your server binding to localhost or 0.0.0.0? Because the URL you provided contains localhost.


darseen

Is your server binding to `localhost` or `0.0.0.0`? Because the URL you provided contains `localhost`.

aspireengginfo-cpu
HOBBYOP

a month ago

Thanks for pointing that out. I’ll verify the server binding.

The application is currently configured to use Railway’s PORT environment variable. I’ll make sure Express is explicitly listening on 0.0.0.0 rather than localhost/127.0.0.1.

One clarification: the “localhost:8080” URL in my log is only the API URL printed by my application; I’ll verify the actual app.listen() binding in src/server.js.

I’ll update the binding and redeploy, then check whether the container still receives SIGTERM.


darseen

Is your server binding to `localhost` or `0.0.0.0`? Because the URL you provided contains `localhost`.

aspireengginfo-cpu
HOBBYOP

a month ago

Hello Railway Team,

I am facing an issue with my Node.js/Express backend service.

Every time I deploy the service, the container starts successfully, but after a few seconds it automatically stops.

The deployment logs show:

  • Starting Container
  • Cron jobs initialized
  • Server running in production mode on port 8080
  • API available at http://localhost:8080/api/v1
  • MongoDB Connected successfully
  • Railway health check receives HTTP 200 from GET /
  • Then immediately: Stopping Container
  • npm error: signal SIGTERM

I have already checked the following:

  1. Railway Serverless is OFF.

  2. I have not configured any Railway Cron Job.

  3. Restart Policy is set to On Failure.

  4. I changed the Railway Custom Start Command to:

    node src/server.js

  5. The application successfully starts and connects to MongoDB before the container is terminated.

  6. The health check is returning HTTP 200.

I have attached screenshots of the deployment logs showing the issue.

Could you please check why Railway is sending SIGTERM to the container immediately after a successful deployment?

Also, please confirm whether this is related to the deployment lifecycle/host migration, resource limits, or any Railway-side issue.

Thank you.

image.png

Attachments


aspireengginfo-cpu

Hello Railway Team, I am facing an issue with my Node.js/Express backend service. Every time I deploy the service, the container starts successfully, but after a few seconds it automatically stops. The deployment logs show: - Starting Container - Cron jobs initialized - Server running in production mode on port 8080 - API available at http://localhost:8080/api/v1 - MongoDB Connected successfully - Railway health check receives HTTP 200 from GET / - Then immediately: Stopping Container - npm error: signal SIGTERM I have already checked the following: 1. Railway Serverless is OFF. 2. I have not configured any Railway Cron Job. 3. Restart Policy is set to On Failure. 4. I changed the Railway Custom Start Command to: node src/server.js 5. The application successfully starts and connects to MongoDB before the container is terminated. 6. The health check is returning HTTP 200. I have attached screenshots of the deployment logs showing the issue. Could you please check why Railway is sending SIGTERM to the container immediately after a successful deployment? Also, please confirm whether this is related to the deployment lifecycle/host migration, resource limits, or any Railway-side issue. Thank you. ![image.png](https://station-server.railway.com/attachments/att_01m1hk3p8beh6t3s4qh77g7wcw)

a month ago

SIGTERM usually sent to container when there are newer deployment, the active deployment get redeployed, or the active deployment stopped/removed

Do you have Hard Usage Limit set on your workspace? It's probably automatically stopped because you've hit your usage limit (If you have it enabled)


Welcome!

Sign in to your Railway account to join the conversation.

Loading...