2 months ago
I have a NextJS app that was working just fine before. Then I got a message about upgrading NextJS because of a vulnerability. I did the upgrade and deployed. Ever since the app deployments go through, but the app doesn't show up or randomly shows up once a while. It fails with ERR_CONNECTION_TIMED_OUT. Couldn't find anything on the HTTP Logs either. Anyone faced this and overcame? It's been down like this for quite a while now.
Pinned Solution
2 months ago
Thank you @ilyass012. I tried your solution but the actual issue was with my DNS provider that doesn't seem to support CNAME records for root domains. Got it to work, and it's all good now. Thanks again for willing to help.
5 Replies
Status changed to Awaiting Railway Response Railway • 2 months ago
2 months ago
When the build passes but the app times out with no http logs is that the app isn't binding to the right port. railway injects a PORT env variable automatically and your app needs to listen on that exact port at 0.0.0.0, not a hardcoded one like 3000. after a next.js upgrade this can silently break things. check that your start command respects process.env.PORT, then go to deployments, clear the build cache, and redeploy fresh
2 months ago
I have the default port 8080 chosen, and didn't customize the port number. It said a port was detected by Railway Magic and showed 8080, and I used that. If that's not what you meant, if you can please guide me to an article, and give me some extra hint I can try to get this taken care of. Thanks for your help.
2 months ago
Yes for sure; next.js doesn't respect the PORT env variable by default, you need to pass it explicitly. go to your service settings and update your start command to this: next start --port ${PORT:-3000} that's it, redeploy and it should work
2 months ago
here's the official railway doc that covers exactly this: https://docs.railway.com/networking/troubleshooting/application-failed-to-respond
2 months ago
Thank you @ilyass012. I tried your solution but the actual issue was with my DNS provider that doesn't seem to support CNAME records for root domains. Got it to work, and it's all good now. Thanks again for willing to help.
Status changed to Solved brody • 2 months ago
