502 Bad Gateway
robleragency
FREEOP

a year ago

I am experiencing this error again in my API deployment. I have read the documentation where I am supposed to be able to solve my problem but I still haven't found a solution.

https://docs.railway.com/guides/public-networking#target-ports

API:

const port = process.env.PORT || 44855; 
await app.listen(port, '0.0.0.0');

I understand that railway reserves the port environment variable

Public Networking:
poseidonreservationsnest-production.up.railway.app -> 44855

6 Replies

robleragency
FREEOP

a year ago

It should be noted that I have another API with the same port 44855 with the difference that this API works correctly


brody
EMPLOYEE

a year ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody about 1 year ago


brody
EMPLOYEE

a year ago

  1. Your target port should be 8080

  2. Your app exited.


robleragency
FREEOP

a year ago

What is the difference between the port 8080 and the defective port that brought me railway 44855?


brody
EMPLOYEE

a year ago

Port 44855 would have been something you selected, so I couldn't tell you why you used that port.


robleragency
FREEOP

a year ago

I understand but even though I modified my ports in both my API project and my public networking to 8080, I still get a bad gateway.

I re-read the docs for the target ports and it seems that I am doing it exactly as in the docs once I modified the ports to 8080.


brody
EMPLOYEE

a year ago

Please see my second point in my previous message.


Loading...