2 months ago
Hi Railway Support,
I'm experiencing an issue where my Node.js/Express container is being stopped immediately after the health check passes. The deployment is marked as "successful" with 1 replica active, but the container keeps receiving SIGTERM and restarting in a loop.
Project Details:
Service URL: gl2taxmarketingwebsite-production.up.railway.app
Region: europe-west4-drams3a
Framework: Node.js with Express
Database: Railway PostgreSQL (connected via DATABASE_URL)
What happens:
Container starts successfully
Server binds to
0.0.0.0:$PORT(port 8080)Health check endpoint
/api/healthreturns 200 OKDeployment is marked "successful"
Container immediately receives SIGTERM and stops
Cycle repeats
Logs showing the issue:
Starting Container9:39:08 PM [express] serving on port 8080
9:39:08 PM [express] NODE_ENV: production
9:39:08 PM [express] Server is ready to accept connections
9:39:08 PM [express] GET /api/health 200 in 8ms :: {"status":"ok","timestamp":"2026-01-13T21:39:08.811Z"}
Stopping Container
[SIGNAL] Received SIGTERM - Railway is stopping the container
What I've already tried:
Using
node dist/index.cjsdirectly (not npm scripts)Adding proper signal handlers to confirm SIGTERM is received
Adding a Procfile with
web: node dist/index.cjsAdding keep-alive intervals (heartbeat every 30 seconds)
Binding to
0.0.0.0on the PORT environment variableHealth check returns valid 200 response with JSON body
Configuration:
Start command:
NODE_ENV=production node dist/index.cjsHealth check path:
/api/healthrailway.json configured with healthcheckPath and restartPolicyType: ON_FAILURE
Metrics:
CPU usage: Normal (near 0%)
Memory usage: ~100MB (well within limits)
No 5xx errors
Health check returns 200
The container is healthy, the health check passes, but Railway keeps sending SIGTERM to stop it. Could you please investigate why the orchestrator is stopping a healthy container?
Thank you for your help.
1 Replies
2 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • about 2 months ago
2 months ago
Hey! Found these that might be useful.
https://station.railway.com/questions/node-container-doesn-t-handle-sigterm-a987cd62
"You are running your application via npm, but npm is not passing SIGTERM correctly to your application. This is a widely known issue that happens everywhere, not just on Railway."