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
Fetch Fails with "Network request failed" only on Android #16451
Comments
My team and I spend the last 2 days debugging this after update to expo 44 as well and we saw the same behaviour, we had to rollback to a previous version because of this. |
I had similar issue with axios and android expo managed, What I did was using flipper to inspect the request & response headers, I found that with axios for api the content type was not correct it was not sending the boundary. The best way to debug is using the flipper or remote js debug & compare the working api call request & response with the not working one. |
Are there any updates to this posting? I'm hitting the same snags today, tried rolling back to |
Am facing a similar issue.Am trying to upload a file using form data.Has there been a fix to this? |
My app was making the fetch like 2 days ago, and now it gives me this error. It was some expo update? Any updates? |
Another option! scan the QR code with expo clients |
I am facing same issue in "Network request failed" error only on Android in Expo. Below solution works for me both platform (Android and iOS): |
I get the same error for my login form with expo go but when I launch it on the web everything works fine |
I suffer from the same issue only on some Android devices. However, on some devices when I completely close the app and re-open the error seems to be gone. Any idea what is wrong or solutions? Managed Workflow |
Having the same issue on expo SDK 46 |
In my case, the issue was caused by incomplete SSL certificate chain on the web server. Adding the intermediate certificate solved it. |
Same case here. |
Seeing this on Expo v47 (works on iOS). Already using |
Can confirm this still exists. I'm facing the same issue on Expo SDK 47 (managed workflow) for Android. |
Okay, so I was able to get through this by setting the fetch(<SOME_URL>, {
...
headers: {
...
'Content-Type': 'application/json'
}
}) |
I also have this same issue on both the emulator and the device on android(only). |
I saw this error while using |
@garrettg123 can you elaborate? Where do I make this change? My server is not local, but remote: |
Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue. The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue. A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own. ResourcesCommon concerns"I've only been able to reproduce it in private, proprietary code"You may not have spent enough time narrowing down the root cause of the issue. Try out the techniques discussed in this manual debugging guide to learn how to isolate the problem from the rest of your codebase. "I didn't have time to create one"That's understandable, it can take some time to prepare. We ask that you hold off on filing an issue until you are able to fully complete the required fields in the issue template. "You can reproduce it by yourself by creating a project and following these steps"This is useful knowledge, but it's still valuable to have the resulting project that is produced from running the steps, where you have verified you can reproduce the issue. |
I can confirm that switching my Graphql calls from http://localhost:8080 to http://191.168.1.16:8080 solved the issue. I had only the problem on Android (emulator and phone) but not on IOS and web. |
For hosted backends, it definitely has something to do with SSL. As a temporary fix, changing the url prefix to |
the same case.Because u don't do this action that .crt and .ca-bundle files have not been combined in one .crt file before uploading to server.You need to do this action before configure ssl in nginx.conf |
Another case: If your site is using |
I had the same error and my problem was coming from .env file, my keys were not prefixed. I changed |
This did it for me too, i have to set my backend to listen on the same IP as my macbook, rather than "localhost". Only then can I connect the App with my Android device or simulator. This isn't an issue with iOS or iOS simulator. |
Summary
Hi Expo Team - On Android async Fetch request fails with an ambiguous "Network request failed" error only on Android. iOS works great. This happens both locally in Expo Go, and in a production apk build on a physical device. Oddly enough, this only happens for ONE endpoint. Currently, I call 4 endpoints using fetch, and 3 work on Android. I highly doubt this is an issue with my server, because the fetch call that fails never makes it to the server. Greatly appreciate any help!
Managed or bare workflow? If you have
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
SDK 44
Environment
expo-env-info 1.0.2 environment info:
System:
OS: macOS 12.2.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - /usr/local/bin/node
Yarn: 1.22.15 - ~/.npm-global/bin/yarn
npm: 6.14.13 - /usr/local/bin/npm
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
IDEs:
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
npmPackages:
babel-preset-expo: 9.0.1 => 9.0.1
expo: ^44.0.0 => 44.0.4
react: ^17.0.1 => 17.0.2
react-native: ^0.64.3 => 0.64.3
react-navigation: ^4.4.0 => 4.4.4
npmGlobalPackages:
eas-cli: 0.47.0
expo-cli: 5.2.0
Expo Workflow: managed
Reproducible demo
Fetch call that fails:
where
getAuthToken()
is:Note:
getAuthToken
works fine and is not the cause of the issue. The issue happens withfetch()
Fetch call that works:
As you can see, these fetch calls are essentially configured the same. The main difference is the URL to which they point. As I previously mentioned, the server isn't receiving the request for the failed fetch. Its not rejecting the request, the fetch just isn't happening. So strange. Please help - I've been scouring the internet for days without any lead. The error "Network request failed" is far too ambiguous. Thank you!
The text was updated successfully, but these errors were encountered: