React-native: axios/fetch request stuck with no error or no response on IOS only

Created on 18 Feb 2020  路  7Comments  路  Source: facebook/react-native

Description:
sending a request with Axios or fetch in IOS not work and it doesn't matter if the API is HTTPS or HTTP
no error reaches the catch or no response received
also no errors, only warnings

2020-02-18 21:31:21.096 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didReceiveNetworkResponse` with no listeners registered.
2020-02-18 21:31:21.100 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didReceiveNetworkData` with no listeners registered.
2020-02-18 21:31:21.100 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didCompleteNetworkResponse` with no listeners registered.

this only happin with IOS , android works fine

React Native version:

System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 40.29 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.15.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.12.0 => 16.12.0
    react-native: 0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. just send any request to any API
    2.

Expected Results

get a result or even error from the API

Snack, code example, screenshot, or link to a repository:

the app stuck here because I'm waiting for a result or error from the request
image

my simple function

export const checkAuth = (accessToken) => async (dispatch, getState) => {
  try {
    const response = await fetch('https://www.google.com', {
      method: 'GET',
      headers: {
        // Accept: 'application/json',
        // Authorization: `Bearer ${accessToken}`,
      },
    })
    const json = await response.json()
    const { error } = json

    if (error) {
      return false
    }
    return true
  }
  catch (error) {
    return false
  }
}

my info.plist
image

Ran Commands For Stack Overflow

Most helpful comment

I'm also getting this error with iOS in release build. I'm trying to send a request to https.
Weirdly if i turn off then turn on my iphone's wi-fi requests starts working.
But after a while requests keep failing again.
I think this issue needs to be reopened.
Note: I'm using axios

All 7 comments

Please use Stack Overflow for this type of question.

@hramos why do you think this is a question and not a bug?

I'm also getting this error with iOS in release build. I'm trying to send a request to https.
Weirdly if i turn off then turn on my iphone's wi-fi requests starts working.
But after a while requests keep failing again.
I think this issue needs to be reopened.
Note: I'm using axios

I've also received issues for an app I'm working on for this exact behavior -- app runs fine, then randomly the first request that needs to be done by the app just hangs and user has to force close the app. Happens only on a release version of the app, so I've used logs to come this far. Has anyone had any luck yet? @mohanagy @GoktuqCan ?

i have the same issue, every http request gets stuck, happened after struggling to get the metro bundler to load the app

Same problem, any solutions?

it was a long time since I opened the issue,
I remember that I resolved this issue by moving the server to another host.
the reason is that the old host doesn't support ipv6
Actually, I don't know what is the point but this was the solution for me

Was this page helpful?
0 / 5 - 0 ratings