Intern Mano
Intern Mano

Reputation: 11

Network Request Failed - Expo Fetch - React Native

Im creating an expo project, I have also built a nodejs server on my machine, get and posts requests work just as expected on the chrome browser and on postman, unfortunately something is wrong on the expo application ONLY, fetch throws the following error

Network request failed
- node_modules\whatwg-fetch\dist\fetch.umd.js:473:29 in xhr.onerror
- node_modules\event-target-shim\dist\event-target-shim.js:818:39 in EventTarget.prototype.dispatchEvent
- node_modules\react-native\Libraries\Network\XMLHttpRequest.js:574:29 in setReadyState
- node_modules\react-native\Libraries\Network\XMLHttpRequest.js:388:25 in __didCompleteResponse
- node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:190:12 in emit
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:436:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:26 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue

Im running an android emulator, the server is reachable through the emulator's browser, but not through the react app. Firewall is disabled. Fetching anything from a public url to works correctly.

Anyone knows why my application (whether run on android emulator or a real ios device) is not reaching the server only in the expo client, it is reachable through the normal browser.

Upvotes: 1

Views: 1307

Answers (1)

user6041236
user6041236

Reputation: 35

Hope your issues is already resolved...

if not - Have you tried connecting from 10.0.2.2 (127.0.0.1 point the simulator loopback) as suggested in the documentation - > https://developer.android.com/studio/run/emulator-networking

if already resolved, please share how you resolved it.

Upvotes: 1

Related Questions