-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network request failed (device and emulator) #1606
Comments
The port for HTTPS is typically 443, you may want to double-check that. Additionally, if you are experiencing the issue on Android, the system uses a different set of root CAs than Chrome does, so you may want to verify that your TLS certificate is (transitively) signed by a root CA installed on your system: https://tamingthedroid.com/trusted-credentials |
Hi guys, running into the same issue when using a localhost dev certificate. Any advise on how to make it accept it? |
I run on the same issue. Here's what the situation looks like: frontend axios.post('http://localhost:3000/authenticate/login', {
testData: 'test data value!'
})
.catch(err => console.dir(err)); express backend import express from 'express';
const app = express();
app.post('/authenticate/login', (request, response) => {
console.log(request.body);
response.sendStatus(200);
});
app.listen('3000', () => {
console.log('Dev server running at http://localhost:3000 or http://10.0.2.2 for android emulator');
});
I found some articles on stackoverflow and a lot more from my duckduckgo search but I wasn't able to find any answer. NOTE
Help please. |
I think it would be good to add these kind of info to the docs. "Making network requests to your localhost". Then add "Using an emulator." and "Using your phone.". |
I think I found the reason why... https://docs.expo.io/versions/v27.0.0/workflow/debugging#if-you-are-using-lan-make-sure |
I'm using the CLI, and I can't see any instructions how to actually configure this thing. |
@viniciuscastelano After going to sleep and upon waking up, I figured out what the answer was. I seem to have forgotten networking fundamentals. What's going on here? I'm pretty new to expo and how it managed to push my app on my phone with wireless connection was a magic at first until I remembered networking. Basically expo pushes the app using the "lan" connection (in my case), your PC and the mobile you are using must be connected to the same network for this to work. Don't get me wrong I don't fully understand how expo works on the foundation level though I'd love to know the secret spell for its magic. (LOLS). My computer is running the localhost server (nodejs) on Find out what your IP is: https://www.wikihow.com/Check-the-IP-Address-in-Linux Now that you know your IP address, instead of doing If someone can explain this better or can add more information as to why the other works and why the other ones don't, please mention me. BTW, I'm using the terminal so to run expo in LAN mode you should do: I hope this helps. |
@aprilmintacpineda I have been dealing with this issue for SO long and this is the first time I was able to successfully make a network request to my localhost!!! Thank you SOOO much!!! |
@aprilmintacpineda Hey Im still facing the problem even i replace my localhost to my IP . Done all the things you have told to do to run the app but Im still facing the problem please help me out |
@chirag773 My suggestion would be to check if the server and the device are in the same network (if they're not, the IP won't work). Thank you, @aprilmintacpineda, for the detailed explanation of how to make it work! 🙂 |
@sjchmiela the server and the device are on the same network but i am still getting the error |
I actually had the exact same issue and none of the solutions worked for me. I'm using expo 30. For now, I ended up deploying the backend and using remote URL but an offline solution is something I really need. @aprilmintacpineda 's answer is excellent (thanks man!)and to my surprise, even that did not help. |
What helps when testing from a real device is to use a service like ngrok. It is easy to setup (3 minutes or so). |
☝️ @AleksandarSavic95 I had a problem with connecting to local server from iPhone expo client, used ngrok and it works perfectly. Thanks! |
Hello,
I am getting the error "Network request failed" (device and emulator) while accessing the URL https://reqweb.cast.com.br:5443/RequerimentoRest/req/login via fetch (). I can access this link via Postman or browser normally.
I wonder if there is a solution for this.
My code is:
Thank you very much in advance.
The text was updated successfully, but these errors were encountered: