2 years ago
The title is pretty much self explanatory, I have this in my code and I don't find the log "beforeExit".
31 Replies
2 years ago
you should probably use the sigterm event instead of beforeExit
process.on('SIGTERM', () => { console.log("exiting...") });2 years ago
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 happening
And I don't see any changes in my database (should exist if my function "saveUsersProgress" launches after SIGTERM
2 years ago
do you run your app with npm run <..>?
2 years ago
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:
2 years ago
try to start it with node directly then
2 years ago
go to your service settings, scroll down and you should find a custom start command
place your start script command there
2 years ago
service*
2 years ago
hey, thats really weird
i'll try to write a code to see whats happening, report back here soon
2 years ago
what did you end up setting your start command to in the railway service settings?
2 years ago
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
2 years ago
awsome!



