Fetch throws 'Network request failed' on Android SDK Platform 24
See original GitHub issueIs this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v
: react-native-cli: 2.0.1 react-native: 0.46.3node -v
: v7.7.3npm -v
: 4.1.2yarn --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:
- Created 6 years ago
- Reactions:9
- Comments:24 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently having this same issue, but I tried running on Android 6.0 with sdk 23 and the issue still persists
i have also same issue ,plz provide solution