0

i am working on a react-native application for about almost a year now, and a function i wrote earlier suddenly stopped working for now reason.. here's the code snippet:

   var array = [];
      fetch('https://reqres.in/api/products/3') //different URL, for testing only
              .then((response) => response.json())
              .then((json) => {  array = json; })
              .then(() => { console.log("get Remote data DONE" + array); 

this code worked great for some time, and now as i had to review my code it suddenly doesn't work anymore.. i get an "network request failed" error msg..

any ideas?

4
  • 1
    On Jul 13, 2021 the site got a new certificate, maybe its CA is not trusted? This might help - stackoverflow.com/questions/33655832/… Commented Aug 31, 2021 at 16:43
  • i've checked my api with this site: digicert.com/help and all certs seem to be fine..i've got no clue why this is happening now :/ Commented Aug 31, 2021 at 16:58
  • check if app is allowed to access internet Commented Aug 31, 2021 at 17:28
  • the issue is within the emulator, i installed a different one and my fetch command succeed's ;) i will try to re-install the emulator, and will report back here if that solves the problem Commented Aug 31, 2021 at 19:04

1 Answer 1

-1

it turns out that the problem was not caused by code i wrote or by any other settings related to react-native. i tried a different emulated device, which i created for testing this issue, and the code completed without any issues at all while debugging on this very device. so i tried to simply wipe my previously used virtual device (https://github.com/google/android-emulator-m1-preview. and now everything is working just fine. problem solved! :)

Sign up to request clarification or add additional context in comments.

1 Comment

Please provide additional details in your answer. As it's currently written, it's hard to understand your solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.