question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fetch throws 'Network request failed' on Android SDK Platform 24

See original GitHub issue

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

  1. react-native -v: react-native-cli: 2.0.1 react-native: 0.46.3
  2. node -v: v7.7.3
  3. npm -v: 4.1.2
  4. yarn --version (if you use Yarn): —

Then, specify:

  • Target Platform: Android
  • Development Operating System: macOS Sierra 10.12.5 (16F73)
  • Build tools: Android Studio

Steps to Reproduce

fetch('https://pricesea.ru/api/auth/info', {
      credentials: 'include'
    }).then(res => {
        ...
      }).catch((e) => {
        console.log(e);
      });

Expected Behavior

Request should return HTTP code 200 and some data or HTTP code 401.

Actual Behavior

I have an error:

TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (fetch.js:441)
at XMLHttpRequest.dispatchEvent (event-target.js:172)
at XMLHttpRequest.setReadyState (XMLHttpRequest.js:546)
at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:381)
at XMLHttpRequest.js:485
at RCTDeviceEventEmitter.emit (EventEmitter.js:181)
at MessageQueue.__callFunction (MessageQueue.js:260)
at MessageQueue.js:101
at MessageQueue.__guard (MessageQueue.js:228)
at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:100)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

I have tested different API SDK Platform versions (from 22 up to 26), the problem reproduces only on API SDK Platform 24 (Android 7.0). I also did this request via native Android app and it was successful on all Platform versions, even 24.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:24 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
tkalejaiyecommented, Feb 16, 2018

Currently having this same issue, but I tried running on Android 6.0 with sdk 23 and the issue still persists

9reactions
mkmudulicommented, Jan 9, 2018

i have also same issue ,plz provide solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetch throws 'Network request failed' on Android SDK Platform ...
I have tested different API SDK Platform versions (from 22 up to 26), the problem reproduces only on API SDK Platform 24 (Android...
Read more >
React Native fetch() throws 'Network request failed' on Android ...
I am using RN 0.46.3. What could be the reason of that? EDIT: I have tested API versions from 22 to 26, problem...
Read more >
Improve "TypeError: Network request failed" error message
I get error messages when I make a request with fetch api on android (btw the same code is working perfectly fine on...
Read more >
Fetch Error : [TypeError: Network request failed] : r/reactnative
When I want to make a request to an endpoint that I want, it throws me the error [TypeError: Network request failed], but...
Read more >
Fetch Standard
At a high level, fetching a resource is a fairly simple operation. A request goes in, a response comes out. The details of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found