React Native + Expo + iPhone - Unhandled promise rejection: TypeError: Network request failed


Im currently working on a React Native / Expo project and have been using the Simulator on my Macbook with no problems for months. The project is using a Rails backend running on port 3000. For the last few days I’ve been trying to use Expo + my iPhone to actually run the application on a physical device, however I’m continuously having what I believe to be networking issues.

[Unhandled promise rejection: TypeError: Network request failed]
- node_modules/react-native/node_modules/whatwg-fetch/fetch.js:441:29 in onerror
- node_modules/event-target-shim/lib/event-target.js:172:43 in dispatchEvent

There are other posts on SO that say to make sure you change localhost over to your actual machines IPv4 address, IE: 192.168.x.x which I’ve tried to no avail. The IPv4 address thats listed in Network Utility is the same IP that Expo spits out when I boot up via npm run ios.

Heres the call I’m trying to make:

 return fetch(`${HOST_NAME}/users/sign_in`, {
   method: 'POST',
   headers: defaultHeaders,
   body: JSON.stringify({
     username: username,
     password: password,

Since I'm guessing someone may ask, here are the headers:

```var defaultHeaders = {
Accept: 'application/json',
'Content-Type': 'application/json',

HOST_NAME would be replaced with `http://192.168.x.x:3000` which again, is the IP value mentioned by Expo at loading time and is also the IPv4 address found in Network Utility.

Are there any other ways to confirm the exact IP I should be using to communicate with my local server?

closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.