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 API returns Network request failed on some websites.

See original GitHub issue

fetch API return Network request failed only on some websites. I was trying to ping the api from my website and found out I kept getting a request error. I can ping the url via postman as a normal get request but for some reason the Fetch API won’t let me.

This happens when debugging on Android (note 9)

React Native version:

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 19.91 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.9.1 - /usr/local/bin/node
      Yarn: 1.19.1 - ~/.yarn/bin/yarn
      npm: 6.12.0 - ~/.config/yarn/global/node_modules/.bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      Android SDK:
        API Levels: 27, 28
        Build Tools: 28.0.3
        System Images: android-24 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4697961
      Xcode: /undefined - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz => 0.59.8 

Steps To Reproduce

  1. Fetch a famous url (facebook , google) no issue.
  2. Fetch a less famous url (crash)

Describe what you expected to happen:

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

https://snack.expo.io/SkFgBWoFH

Code to reproduce:

fetch('https://facebook.github.io/react-native/movies.json')
    .then(response => {
        console.log(response);
    })
    .catch(function(err) {
        console.info(err);
    });

fetch('https://pixiumdigital.com')
    .then(response => {
        console.log(response);
    })
    .catch(function(err) {
        console.info(err);
    });

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
crimson-medcommented, Aug 24, 2020

I don’t think this is stale as a few people have had the same issue and this was never addressed.

1reaction
crimson-medcommented, Jan 20, 2020

This issue has never been fixed as it was never picked up dear bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native fetch() Network Request Failed - Stack Overflow
1) and put a fetch in the render method to the public facebook demo movie API, it throws a Network Request Failed ....
Read more >
HTTP Fetch fails with "TypeError: Network request ... - GitHub
Using fetch to get/post on a HTTPS web server which is using a valid and trusted but not public CA. Using Chrome and...
Read more >
Detect Network Failures When Using Fetch | by Aaron Bruce
Fetch throws “Network request failed”​​ This error will be thrown if you attempt to issue a GET request to “google. comm” — an...
Read more >
Improve "TypeError: Network request failed" error message
Network request failed, this error occurs usually when api call failed or you have some internet issue. In android emulator, sometimes this error...
Read more >
fetch() - Web APIs | MDN
The global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response...
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