Occasionally getting 503 responses (Express app)
wouterfm
TRIALOP

2 years ago

Hi all,

Very occasionally, I receive 503 Service Unavailable responses from my Railway app. My Express app simply returns a local variable and nothing else, so it seems unlikely that the app itself is causing the unavailability.

Is there a way to view logs for errored requests that my app didn't process? And is this a common problem?

Regards,
Wouter

27 Replies

brody
EMPLOYEE

2 years ago

503 means usually means your app didn't respond to the request from Railway's proxy, have you checked your deployment logs?

Are you listening on 0.0.0.0 and $PORT?


wouterfm
TRIALOP

2 years ago

Yes! Listening on 0.0.0.0 and $PORT. No errors appear in the logs, and it's handling 98% of the requests, just some seem to fail


brody
EMPLOYEE

2 years ago

Are you getting these errors at the same time you are deploying?


wouterfm
TRIALOP

2 years ago

Nope, after deploying


brody
EMPLOYEE

2 years ago

Shortly after deploying?


wouterfm
TRIALOP

2 years ago

Let's say > 15 minutes after deploying


brody
EMPLOYEE

2 years ago

Did you change a variable >15 minutes after deploying?


wouterfm
TRIALOP

2 years ago

No, nothing


brody
EMPLOYEE

2 years ago

All signs are currently pointing to an issue with the app, tell me more about what the failing request does internally including any middleware.


wouterfm
TRIALOP

2 years ago

The only thing that it does is return data (where data is a variable). No middleware, no validation. That's why I think that it is almost impossible for the app to not be able to respond


brody
EMPLOYEE

2 years ago

After this >15 minute mark, if you hit the app at 1 req/s for 5 minutes, how many requests would you say fail?


wouterfm
TRIALOP

2 years ago

I'd say 5 out of 300. It is very occasionally, but still want to make things sure :)


brody
EMPLOYEE

2 years ago

What is the start command in use?


wouterfm
TRIALOP

2 years ago

No custom start command is set in the config, so I assume it checked my package.json and did yarn start (as start is defined in the package.json)


brody
EMPLOYEE

2 years ago

Right and what is yarn start set to.


wouterfm
TRIALOP

2 years ago

nodemon start src/index.js


brody
EMPLOYEE

2 years ago

Regardless if nodemon is causing issues here, it's never a good idea to use nodemon in production, remove the use of nodemon and let me know if the issue continue.


wouterfm
TRIALOP

2 years ago

I know, I am testing out railway, so I just kept everything as-is. For production I wouldn't use it either. The issue happens after the app has been started, so that shouldn't be related to Nodemon, right?


brody
EMPLOYEE

2 years ago

Even locally you shouldn't use nodemon in the start script, nodemon should only be used in dev scripts and alike.

At this time I wouldn't know if nodemon is causing this issue, but it's definitely incorrect to use it in your start script and on Railway, so it is something you should remove from the start script and report back if the issue continues. It would also be a good idea to make sure Railway is indeed using the start script, you can see what start command Railway will use in the build table at the top of your build logs.


wouterfm
TRIALOP

2 years ago

Alright! Will make the app a little more production-ready, and check if the issue persists. If so, I'll report back. Thanks for now!


brody
EMPLOYEE

2 years ago

Sounds good!


wouterfm
TRIALOP

2 years ago

Hey, update on this ticket. Did a test for some hours now, seems that on 1000 requests, 3 fail. Which is nothing, but still raises the same question as in the beginning. Any clue if this could be on Railways side, or a wrong configuration?


brody
EMPLOYEE

2 years ago

Are you able to consistently reproduce that?


wouterfm
TRIALOP

2 years ago

No unfortunately not. It seems very occasionally. The other time I tested it, I got no errors at all


brody
EMPLOYEE

2 years ago

Whats the memory usage like? You only have 500MB available on the trial plan.


wouterfm
TRIALOP

2 years ago

Overview of the metrics attached

Attachments


brody
EMPLOYEE

2 years ago

Would it be possible to ask you to test if you can reproduce this behaviour with the express hello world code?


Loading...