Skip to content
Requests failing frequently
jccintr
OP

4 months ago

Why do I frequently get this error when trying to make a request to my API using React Native/Expo Go?

Login Request

LOG → Request (1): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Tentativa 1 falhou. Tentando novamente...

LOG → Request (2): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Tentativa 2 falhou. Tentando novamente...

LOG → Request (3): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Erro no fetch: [TypeError: Network request failed]

Earlier, I only got [TypeError: Network request failed].

In the same app, I tested endpoints from another API (Java) hosted on Railway, and it responded normally to all requests.

In Postman and other languages, the requests do not fail.

To wrap up, I deployed the same API to another service (Render) and it worked without issues. That’s why I think something is wrong.

Solved$10 Bounty

7 Replies

Railway
BOT

4 months ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 4 months ago


azashi

4 months ago

Looks like health check is failing after deployment.

Can you check your health check config in the service.

If there is a endpoint configured in railway panel, you need that endpoint in service.

If you do not have the endpoint implemented, remove the health check path from panel, untill you get it up and running.

image.png


manuproject

4 months ago

this is a known combo, react native on android + railway. two likely causes:

check if App Sleeping is on - service settings → deploy → app sleeping (serverless). if your api sleeps after idle, the first requests after a pause fail while it wakes up, and your 3 quick retries all land during the wakeup. postman works because by then its awake, and render doesnt sleep. turn it off and test again.

if sleeping is already off, its stale keep-alive connections. androids okhttp reuses open sockets, but railways edge proxy closes idle ones sooner than renders does, so the reused socket is dead and fetch throws "network request failed". quick test: add Connection: close to your fetch headers - if the errors stop, thats it. then either keep that header or add retry with a small delay instead of instant retries.

btw your retries firing instantly back to back is why all 3 fail, put like 2-3s between them either way


azashi

Looks like health check is failing after deployment. Can you check your health check config in the service. If there is a endpoint configured in railway panel, you need that endpoint in service. If you do not have the endpoint implemented, remove the health check path from panel, untill you get it up and running. ![image.png](https://station-server.railway.com/attachments/att_01kyvdnhe0fanaf6ggnhjc8qay)

jccintr
OP

4 months ago

The health check is fine now. However, the issues with the requests persist.

Request (1): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/register

LOG Tentativa 1 falhou. Tentando novamente...

LOG → Request (2): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/register

LOG Tentativa 2 falhou. Tentando novamente...

LOG → Request (3): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/register

LOG Erro no fetch: [TypeError: Network request failed]

LOG Login Request

LOG → Request (1): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Tentativa 1 falhou. Tentando novamente...

LOG → Request (2): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Tentativa 2 falhou. Tentando novamente...

LOG → Request (3): POST https://api-delivroo-express-node-production.up.railway.app/api/riders/login

LOG Erro no fetch: [TypeError: Network request failed]


manuproject

this is a known combo, react native on android + railway. two likely causes: check if App Sleeping is on - service settings → deploy → app sleeping (serverless). if your api sleeps after idle, the first requests after a pause fail while it wakes up, and your 3 quick retries all land during the wakeup. postman works because by then its awake, and render doesnt sleep. turn it off and test again. if sleeping is already off, its stale keep-alive connections. androids okhttp reuses open sockets, but railways edge proxy closes idle ones sooner than renders does, so the reused socket is dead and fetch throws "network request failed". quick test: add Connection: close to your fetch headers - if the errors stop, thats it. then either keep that header or add retry with a small delay instead of instant retries. btw your retries firing instantly back to back is why all 3 fail, put like 2-3s between them either way

weverson-luan

3 months ago

I've been dealing with the same problem for months... If you find a solution, please share it.


fwebmaster-gt

3 months ago

I have the same problem. All my Expo apps are failing. The only solution when it starts acting up is to change my API region; that fixes it for a few days. 🤬🤬


jccintr
OP

3 months ago

I found the solution: using another service like Render, where I don't have this kind of problem.


2 months ago

Hey all, we have rolled out a fix for this. It turned out to be an issue with an upstream dependency.

Please let us know if you continue to see issues.


Status changed to Awaiting User Response Railway • 2 months ago


Railway
BOT

2 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...