REACT NATIVE EXPO APP unable to make HTTP request to an API using AXIOS after "BUILD" but works perfectly with EXPO GO

A Warm Hello to all Enthusiastic Coders!, I would love to share among You all about a very interesting yet a bit challenging issue that I have encountered while developing a React Native Android App Using EXPO.The mechanism is by USING AXIOS TO MAKE A SIMPLE REQUEST TO A HTTP API. AND EVERYTHING WORKS FINE WITH EXPO GO ,but once the app is built with EAS, I get an error: no request is sent from the app ,I was able to figure this out with an analysis proxy. In fact, I’ve even rebuilt the app several times and tried using fetch, but nothing happens, always the same error, and above all, impossible to know which one. I think the solution is quite simple, or that there’s simply something missing, but what? it’s impossible to know.
The request is just a basic GET request to an HTTP server, and worked perfectly in the browser and with node. Kindly help me to fix this out as by what to alter or write new lines in files such as “app.json” or 'app.config" or any other files for that matter! Thanks!

1 Like

Hi, I ran into a similar problem. The problem is that the development builds built with EAS don’t allow regular HTTP requests to be made for security reasons. This can be configured in app.json to allow http requests.

For ios and android:

"ios": {
    "infoPlist": {
      "NSAppTransportSecurity": { 
        "NSAllowsArbitraryLoads": true 
      }
    }
},
"android": {
    "usesCleartextTraffic": true
},

These should work. The ios one worked for me but I don’t have an android to test that, but this is what I found online.

Edit: There may be a problem with uploading to the Appstore with this set to true, so if you run into problems that might be it.

Hey! @quinhouck, sry for the late reply!..Thanks a lot for your analysis and time…,Yess it worked absolutely Perfectly in Android too!, thanks a Ton Man!!! Cheers!!..

I’m so happy i found you. Question though, how on earth did you troubleshoot this?