[TypeError: Network request failed] either with fetch API or axios on android

See original GitHub issue

I have a problem with fetching an API on my code I use both fetch and axios but the result is same: [type error: Network request failed]

here is my code for fetch: useEffect(() => { fetch('https://jsonplaceholder.typicode.com/users') .then((res) => res.json()) .then((data) => { console.log(data) }) .catch((err) => console.log(err)) }, []);

I don’t use an emulator because my CPU doesn’t support vt-x. so I use a Xperia TX which has android 4.3 and I connect it over Wi-Fi to see my result. it work properly so far but the only problem is this API fetching.

React Native version:

0.63.2

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
gvsakhilcommented, Jan 31, 2021

Still I have this issue. Sometimes my https api works and sometimes it throws [TypeError: Network request failed]

IOS is working fine but not android

1reaction
geovriscocommented, Jun 3, 2021

Hi @SohaibKtb @akeuk The issue got resolved for me after correctly installing the SSL Certificate.

how? i have same problems

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native TypeError: Network request failed with fetch()
I'm using React native for developing an android application. With this fetch request I'm getting the error ...
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 >
axioserror request failed with status code 400 in react native
Hi Everyone, I found this problem on my React-Native Android App. When I using a fetch to communicate with a working api, this...
Read more >
Fetch API - MDN Web Docs
The Promise returned from fetch() won't reject on HTTP error status even if the response is an HTTP 404 or 500 . Instead,...
Read more >
Network Request Failed while uploading image to server
OS === "android" ? image.uri : image.uri.replace("file://", ""), type: 'image/jpeg', name: 'photo.jpeg'}); //API that use fetch to input ...
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