R
Railway2mo ago
Jon

Nextjs deployment with standalone output results in server error page

I am deploying a nextjs application from a github repo and it works well with the normal "next start" command. However, I want to make use of the next standalone output. Adding output: "standalone" to the next config file results in the following warning: "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.. So then I created a new script command: "railway": "node .next/standalone/server.js" and added npm run railway as the new start command for the service. However this results in the public railway domain going to a railway error page. Here are the logs on redeploy:
No description
Solution:
try setting a HOSTNAME service variable to 0.0.0.0 as for the sigterm error, you would want to set your start command to node .next/standalone/server.js in the service settings, this is because npm does not pass down sigterm properly....
Jump to solution
7 Replies
Percy
Percy2mo ago
Project ID: bc89077a-09e0-4e2e-99a9-16c25f87a05d
Jon
JonOP2mo ago
bc89077a-09e0-4e2e-99a9-16c25f87a05d
Solution
Brody
Brody2mo ago
try setting a HOSTNAME service variable to 0.0.0.0 as for the sigterm error, you would want to set your start command to node .next/standalone/server.js in the service settings, this is because npm does not pass down sigterm properly.
Jon
JonOP2mo ago
Okay so setting the hostname var fixed the server error. But I was not able to fix the sigterm error. Still get that same error.
No description
No description
Brody
Brody2mo ago
that's from your old deployment where you were still using npm
Jon
JonOP2mo ago
Okay, yeah, seems I needed to redeploy again for the changes to take effect. Working now. Thanks!
Brody
Brody2mo ago
no problem!
Want results from more Discord servers?
Add your server