5 months ago
I have a very simple Node app (vanilla JS with Fastify).
During initial deployment, it always hits SIGTERM and the container shuts down:
> my-app@1.0.1 start
> node index.js
my-app is listening on port 8080
Stopping Container
npm ERR! path /app
npm ERR! command failed
npm ERR! signal SIGTERM
npm ERR! command sh -c node index.js
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-12-03T19_54_05_039Z-debug-0.log
The 8080 port is passed in via Railway's PORT env var (as far as I know), and there shouldn't be any issues there?
Curiously, it always fails the first time, then works from there. Any clues?
3 Replies
5 months ago
Hello,
Those logs you are looking at are for old deployments that have been replaced by a new deployment.
The app prints that error because its not being passed the sigterm signal by npm.
To avoid it, update your start command in the service settings to run the app with node directly instead of through npm.
Hope this helps!
Status changed to Awaiting User Response railway[bot] • 5 months ago
Status changed to Awaiting Railway Response railway[bot] • 5 months ago
Status changed to Awaiting User Response railway[bot] • 5 months ago