R
Railway5mo ago
Stroggo

nodejs express endpoint not returning html on railway but works on local environment

Hi! I have an endpoint on my nodejs express backend called [server]/reference which returns a static html page with a reference to my REST API. It works fine when I hit the endpoint on my local environment but as soon as I deploy it to railway I get a Server Error - Application failed to respond back. I don't know if it's me or railway, but has anyone experience with this that can give me a few pointers?
Solution:
OK, solved it by reading https://docs.railway.app/guides/fixing-common-errors. I learned that my service needs to listen to the a environment variable called 'PORT'. I had defined my own port variable names. This means that I don't have to create an environment variable in railway for ports, it's just silently there and assigned by railway....
Jump to solution
5 Replies
Percy
Percy5mo ago
Project ID: e126baf1-bce3-4dec-8e00-57028621b1f3
Stroggo
Stroggo5mo ago
e126baf1-bce3-4dec-8e00-57028621b1f3
Solution
Stroggo
Stroggo5mo ago
OK, solved it by reading https://docs.railway.app/guides/fixing-common-errors. I learned that my service needs to listen to the a environment variable called 'PORT'. I had defined my own port variable names. This means that I don't have to create an environment variable in railway for ports, it's just silently there and assigned by railway.
Stroggo
Stroggo5mo ago
I have no clue how to mark it as solved, I don't get any option for that when right clicking the solution message and then clicking apps. I only see to 'summarize.. ' alternatives
Fragly
Fragly5mo ago
Oh yea sorry, we removed the ability for members to mark threads as solved