TypeError - Network Request Failed (no hint where problem is)

I face big complications here, my app doesnt start up and I get this strange error I havent faced before. Im running my app via Expo, just as a sidenote.

[Unhandled promise rejection: TypeError: Network request failed]

  • node_modules\whatwg-fetch\dist\fetch.umd.js:535:17 in setTimeout$argument_0
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:383:16 in callTimers
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
  • [native code]:null in callFunctionReturnFlushedQueue

I tried already to reinstall expo - did not help me in any way.

3 Weeks ago when I started my break from coding everything worked fine. I dont know what is the problem, the error is not pointing at any special part of the code. I can provide you with any informations needed, because at this point I dont even know where I should start to look for any errors.

Upvotes: 4

Views: 12006

Answers (2)

shahid
shahid

Reputation: 1

It is because your whatwg-fetch stop connection to this url because multiple calls at a time so, Just Change your Route name i.e, for eg: if your Url is like "http://10.0.2.2:4000/login" change it to something with new name like "http://10.0.2.2:4000/loginuser" and try

Upvotes: 0

Subha
Subha

Reputation: 580

If you are using an emulator then the issue could be that the localhost on Android/ios is pointing to the emulated Android/ios device, and not to the machine on which your server is running.

The solution is to replace localhost with the IP address of your machine. Try changing http://localhost:4000 by http://10.0.2.2:4000/

I picked this up from this post Maybe this helps

Upvotes: 5

Related Questions