Expo Go gives me a Generic "Network Error Message" for an Axios Request

I receive a “Network Error” request when I attempt to make an Axios Request
in my application. I am using a MERN stack implementation and making an Axios
request from the frontend to my backend to connect to a MongoDB Instance on Atlas.
I run a windows host machine and I code on a ubuntu virtual machine instance via VMWARE.
I use the Expo Go app to scan the qr code directly with my Android Device (Not an Emulator).
I use the Expo Managed Workflow (Not bare or standalone). The LAN and Local never
worked on my virtual machine instance, however, using “expo start --tunnel” seemed
to do the trick. However, for my current application which requires using axios to
makes request to my backend/mongodb instance, I end up with this “Network” Error.

Potential Issues

(I am not able to get the app working via scanning a QR code on Expo Go
on my Android physical device. LAN and LOCAL both result in a network issue
for all my Expo apps. “expo start --tunnel” worked for my previous non-axios call
applications, As for my current app that makes Axios calls, the app loads on Expo Go
via an “expo start --tunnel” command, but just fails on the action that triggers the Axios call,
generating a “Network Error” )

IP ADDRESS

Based off what I have researched, these are some of the potential issues.
I have tried them but nothing seemed to work.

I’ve tried using http://10.0.2.2:5000/ or instead of localhost, use
http://hardcoded-ip-address:5000/

Tried using both the IP address for my Ubuntu Virtual Machine 
Tried using the IP address on my Windows Host Machine

			 (Did not work)

HTTP/HTTPS

I made sure to use “http” and then tried “https”

			(Did Not work)

Axios

I also found that it my be an Axios versioning issues, I tried getting
a previous version of Axios installed via Yarn, and a newer version,

			(Did Not work)

CORS

I tried passing the appropriate headers to allows CORS
and for form data

‘Access-Control-Allow-Origin’] = ‘*’;
‘Content-Type’] =‘application/x-www-form-urlencoded’;

                  (Did Not work)

Flipper

I read something about Flipper for Android (and that I needed
to comment out some lines in the AndroidManifest or somehwere). However, that seems to be only
possible when I eject, so I will get the android folder.
(I am using the Expo Managed workflow, so don’t know how to fix this
issue, if it is what is causing the network error). If this is the issue,
is there anyway to resolve it on an “Expo Managed” workflow, as opposed
to Bare or standalone?

Overall, I’m not sure if this is an IP address issue via expo start --tunnel
an Axios specific versioning issue, or something Android specific issue to
do with Flipper.

Like, would this issue not happen if I didn’t run through a Virtual Machine,
(doesn’t seem like the issue for me, because I was able to run very basic
React-Native/Expo apps on my Virtual machine, via expo start --tunnel, the
expo start on the LAN and LOCAL didn’t work, but --tunnel did for the simpler
non-axios call type of applications).

I’ve really lost and much help would be appreciated. Thanks :slightly_smiling_face: