does railway support on("beforeExit")
The title is pretty much self explanatory, I have this in my code and I don't find the log "beforeExit".
Solution:Jump to solution
it seems that if you run it with npm, npm will receive the sigterm instead of node because node process is a children of the npm process
info: https://help.heroku.com/ROG3H81R/why-does-sigterm-handling-not-work-correctly-in-nodejs-with-npm...
21 Replies
Project ID:
a3b76fbf-72bb-4131-9e22-b084af93e94a
a3b76fbf-72bb-4131-9e22-b084af93e94a
you should probably use the sigterm event instead of beforeExit
also Railway force kills your container after a while if it takes way too long to exit, you can set the
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
to how long you want to prevent that from happeningcool ! thanks
SIGTERM is never logged
And I don't see any changes in my database (should exist if my function "saveUsersProgress" launches after SIGTERM
do you run your app with
npm run <..>
?Solution
it seems that if you run it with npm, npm will receive the sigterm instead of node because node process is a children of the npm process
info: https://help.heroku.com/ROG3H81R/why-does-sigterm-handling-not-work-correctly-in-nodejs-with-npm
yes it stats with npm run
try to start it with node directly then
what should i change then ?
add a build command and then node index.js
(its a ts project)
go to your service settings, scroll down and you should find a
custom start command
place your start script command there
service*@ThallesComH Hey sorry for the delay
it didn't work
no logs when redeploying
none of those
hey, thats really weird
i'll try to write a code to see whats happening, report back here soon
ty
what did you end up setting your start command to in the railway service settings?
likely just an incorrect start command, since thalles is right, this is caused by you running your app through npm as npm does not pass down signals
Just checked back, It seems like I didn't save the changes, did it now and it works
ty so much guys
awsome!