502 Bad Gateway error
scotwllm
FREEOP

8 days 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.

$10 Bounty

4 Replies

Railway
BOT

8 days 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!


scotwllm
FREEOP

8 days 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


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?


0x5b62656e5d

1) I would switch to a newer version of Node, 18 is deprecated IIRC2) Make sure your URL is listening to that port3) Any error logs?

scotwllm
FREEOP

8 days 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.


Loading...