previous deployment crash
When I deploy the API (express, nodejs, socketio) everything goes well,
but right before the new deployment will replace the old one,
I see on the dashboard and I get an email notification
Deployment crashed for [service name] in [project name]! why this happens? is there something I can do? project id: b799250d-dd7b-47bb-be65-0ae878afd304
Deployment crashed for [service name] in [project name]! why this happens? is there something I can do? project id: b799250d-dd7b-47bb-be65-0ae878afd304
Solution:Jump to solution
I don't think yarn is passing signals down, can you have railway start index.js directly with node?
33 Replies
Project ID:
b799250d-dd7b-47bb-be65-0ae878afd304
did the deployment actually crash or is it a false report? I don't think you specified this information
I think it's a false report. however it's slightly annoying.
The new deployment is completely fine, deployed, works, and never crashes.
But the previous one, when it's killed by railway, marked as CRASHED in the control panel and I also get an email about this.
with the next deployment it happens again.
unfortunately, there are no logs for previous deployments or explanation the source of the crash.
is your app handing sigterm properly?
I guess, it did not. maybe this is what I am looking for
its not like you are using nodemon or pm2 right?
no, I do not use nothing external. pure railway
what do the logs say of that crashed service?
nothing in logs,
yarn run v1.22.22
$ node index.js
Connection has been established successfully.
server started at 3040
those are logs from the service that was marked as crashed?
yes
found something like How do I shut down my Express server gracefully...
trying this. thanks for the tip
let me know how that goes!
but, are you on the legacy or v2 runtime? check your service settings
the service/project was created last month. I did not choose the runtime, and I hope that by default it's latest
well could you please check
I do not know where yo see it
the service settings
aha.. legacy
shall I change it?
you can try it
neither that code, nor v2 did not help.
okay, I will try to make some experiments and come back later
do you see the
Received kill signal, shutting down gracefully
logs on the crashed service?no 😦
back to the drawing board
okay, locally it catches sigterm and sigint.
if I run the api locally and kill it somehow, I get in the console
on Railway this message does not appear.
https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html
what is your start command on railway?
just yarn start
thanks, what is your start script?
what is the start script for apps/ai-api?
"scripts": {
"dev": "node --env-file=.env.local index.js",
"start": "node index.js"
},
Solution
I don't think yarn is passing signals down, can you have railway start index.js directly with node?
ok
@Brody I owe you a beer. Resolved. Thanks a lot!
no problem!