10 months ago
The project is listed as successful, and I can't find any errors anywhere, but when I try to view the site I just get a 502 bad gateway error. I've been trying to figure this out for two days. Unfortunately, I'm not very smart though.
Pinned Solution
10 months ago
-
I would switch to a newer version of Node, 18 is deprecated IIRC
-
Make sure your URL is listening to that port
-
Any error logs?
4 Replies
10 months ago
Hey there! We've found the following might help you get unblocked faster:
- 🧵 Application Getting 502 Bad Gateway Error After Deployment
- 🧵 502 Bad Gateway Error Despite Server Running Successfully
- 🧵 Error 502 Bad Gateway
If you find the answer from one of these, please let us know by solving the thread!
10 months ago
server.js present at root
Express static route configured
npm start launches server (!) confirm in logs -- look for node server.js
Railway sees "start":"node server.js"
Node version modern enough (!) sugest 18.x -- add "engines":{"node":"18.x"}
Public folder routing
Server listens on process.env.PORT
Build: npm install
Start: npm start
Server: server.js using Express, static files in /public
PORT: process.evn.PORT || 8080
Node: Should be 18.x
10 months ago
-
I would switch to a newer version of Node, 18 is deprecated IIRC
-
Make sure your URL is listening to that port
-
Any error logs?
0x5b62656e5d
1) I would switch to a newer version of Node, 18 is deprecated IIRC 2) Make sure your URL is listening to that port 3) Any error logs?
10 months ago
Hi there -- thanks so much for helping me. I'm not sure if your suggestion is what made it work, but I think it was because we were going back and forth between using port 4000 and 3000, and most recently we thought let's just use the port Railway recommends, 8080. I was looking through every screen I could find until I ran across something trying to use port 3000. I switched it to 8080, and I don't get the 502 Gateway error anymore.
Status changed to Solved noahd • 10 months ago
