4
votes

I had a working project, that has worked for the past 3 weeks. All of a sudden, out of nowhere, the fetch requests have stopped working.

I haven't run any update or npm installs. So I'm lost as to what could be the cause of this.

my fetch request is pretty standard. Simplified here with a console.log instead of setState in the response.

fetch("https://54fd510.ngrok.io/api/v1")
.then((response)=>response.json())
.then((responseData)=>{
  console.log(responseData);
}).done();

All I get now whenever doing any sort of request, is "Network Request Failed" with... onload. _sendload, setReadyState as the stack trace items.

Infact any and all my fetch requests in the app arent working.

So I tried boiling it down, and just created a new blank app.
With only a button and a fetch request linked to the button. To make sure it has nothing to do with my particular app. And this request fails as well.

So it appears its react-native itself that is failing, it isn't anything to do with my code.

No matter what I try, the network request is always failing. Tried downgrading, and get the same.

Really lost as to where to look now.

Any ideas?

Are you sure your ngrok pipe is working? iOS or Android, or both? Simulator or device, or both? - jevakallio
Ngrok works. At first I had a CORS error, which I thought was obviously the problem. But then I fixed that server side, and the problem still persists. Im using Android real, and emulator. Both dont work. I then tried just a basic test endpoint using jsonplaceholder.typicode.com, and that didn't work either. The test endpoint however, hangs for about 4 seconds, and then comes back with a fail. So at least thats something. The last thing to try, is to downgrade to a version where you had to require('fetch'), just to see if somehow thats the culprit - Kylie
@KyleK found out the error? I am facing the same issue. Running my nodejs backend on localhost - PrivateOmega
Hi , I am facing the same issue - Shubham1164