NextJS Application Random Crash
Hey π
I have a NextJS service running on Railway which suddenly crashed (there were no active users at that time so the app was idle).
After a restart of the service, everything went back to normal.
On the deploy logs I see a SIGTERM signal (see below), I'm not sure though if it's there because of the restart attempts.
1. If the crash wasn't because of the SIGTERM, how can I investigate this more thoroughly?
2. If the crash was because of the SIGTERM - why did that happen, and how can I prevent it or at least make sure Railway automatically restarts the service?
Thanks!
31 Replies
Project ID:
4c244bec-c9dc-4d97-b44d-c09dcf0b97d3
You might find these helpful:
- npm error when I shut down the server
- Railway automatically removes deployment
β οΈ experimental feature
4c244bec-c9dc-4d97-b44d-c09dcf0b97d3
could you link your discord to railway please?
Sure, linked it
where you on the trial plan at the time?
No, haven't been on trial for about 2 months I think
This happened again today, restarting the service didn't help, but a redeploy seemed to fix the issue for now. Any ideas? @Brody
#πο½readme #5
oops sorry, won't happen again. Would appreciate any help on this issue π
send your repo please
and show me what your metrics look like during these crashes
In the 2nd image you can see the downtimes, started around 03:30am IDT, ended after I redeployed the serviced at 07:30am.
The metrics seem stable π
The Github repo is private unfortunately, is there anything specific I could share that might be helpful?
package.json
how much traffic does this site get?
It's a monorepo, so this package.json is shared between all the services i have on the project
Not much traffic at all, we're still on a closed beta
around the time the crashes started I see there was no activity at all
could you send the nx.json?
is the front-end a csr app?
Nope, SSR
could you send me whatever config file is used to setup nx serve?
This is for one application, the others are pretty much the same
it seems you have your app serving in dev mode
https://nx.dev/packages/next#serving-next.js-applications
I'm sure that the apps are running in production mode, in the screenshots you can see that on the development env the
buildId
is development
and on production there's some random hashCan you share maybe what is the meaning of a service getting SIGTERM on Railway? That might help me find the root cause here
in case its applicative
the app might be getting build as prod, but the server isn't running as prod, please check the link I sent and apply that flag
you also have Doppler set to dev, that's unwanted too
OK, I'll make sure that the apps are running in full prod mode. Thanks!
What would cause a service to get a SIGTERM though?
that sigterm likely isn't coming from railways container manager
so my running guess is some unexpected side effect of running your server in dev mode
Ok, I'll do some testing and see how it goes.. Hopefully you're right π€
Thanks for the help!
happy to help, I hope you get it sorted
also, generally a bonus side effect of not running a dev server is less ram usage