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:Solution:Jump to 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....7 Replies
Project ID:
bc89077a-09e0-4e2e-99a9-16c25f87a05d
bc89077a-09e0-4e2e-99a9-16c25f87a05d
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.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.
that's from your old deployment where you were still using npm
Okay, yeah, seems I needed to redeploy again for the changes to take effect. Working now.
Thanks!
no problem!