7 months ago
Hello! I'm deploying my Next.js app as usual. The app respects the PORT environment variable, but no matter if I leave it empty and let Railway handle it like it usually does (it sees that next-server is running on 8080), or set PORT to 3000 and set port to 3000 in my domain configuration, I still get 502 errors.
Building and starting the container locally on random ports works fine.
I've tried accessing both my own domain and the one provided by Railway.
Starting Container
▲ Next.js 15.4.7
- Local: http://08f4b604397b:3000
- Network: http://08f4b604397b:3000
✓ Starting...
✓ Ready in 100ms
Pinned Solution
7 months ago
Must’ve been some issue with how I was working with the standalone output of Next.js. I ended up switching to yarn start and it works now.
6 Replies
7 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
7 months ago
The solution in those threads is to set the port manually in the domain configurations and I did exactly that and I'm still getting 502 errors.
7 months ago
Please help or else I'm taking a loan and deploying my app to Vercel.
7 months ago
Add the PORT variable in the environment variables of your Railway instance for the next.js app & set it to 3000, like this:
And make sure that no other service of your Railway account is running on PORT 3000!
Give that a try
clashing
Add the PORT variable in the environment variables of your Railway instance for the next.js app & set it to 3000, like this:And make sure that no other service of your Railway account is running on PORT 3000!Give that a try
7 months ago
Yeah, I already have the PORT variable set to 3000 in the environment variables.
There’s a ton of services in my whole account sharing the same port and they all work fine. Still getting 502 on this particular one.
7 months ago
Must’ve been some issue with how I was working with the standalone output of Next.js. I ended up switching to yarn start and it works now.
Status changed to Solved christian • 7 months ago
