[TypeError: Network request failed] either with fetch API or axios on android
See original GitHub issueI 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:
- Created 3 years ago
- Reactions:6
- Comments:14 (1 by maintainers)
Top 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 >
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 Free
Top 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
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
how? i have same problems