-
Notifications
You must be signed in to change notification settings - Fork 787
[Android] Error: Network error: Network request failed #1228
Comments
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo! |
This issue has been automatically closed because it has not had recent activity after being marked as no recent activyt. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo! |
This happens for me as well. For me no auth is involved, and I'm using HttpLink. If you're interested in debugging, let me know, for now I'm using iOS for debugging. |
Please re-open the issue! I encounter the exact same problem:
In my case, uri is local: |
If you're using the Android Emulator, in your client code, don't use localhost to access graphql. Use the IP address of the emulator host machine which is usually
The iOS simulator works because its a simulator. It shares the same IP address with the host machine. The emulator runs as a VM that has its own IP address so localhost would resolve to the emulators own IP address. |
I have been struggling with this issue for about 6 days now. I don't know the cause at all. I am stuck right now. I didn't experience this why I was using Expo. But I switched back to core React Native because I needed to use some native modules. Any suggestion will help because my client is on my neck. @symphonicz Please were you able to resolve this issue? @emmanuelnk I am not using localhost. This error occurs when I upload an image to the server. It is uploaded successfully, but I am not able to get response at the mobile app side |
Same error when I try to load http://..../graphql on Android device, but ios no problem. |
Same issue while running on Android Device, request just fails with no detail |
OK, as @smithaitufe said, the "localhost:xxx" port in your Android phone is not the same as that of your computer. So apollo is making a request in a server that does not exist. You need to redirect a phone port to "3000" or whataver you are hosting as instructed Here so localhost:"XXXX" (phone) redirects to localhost:"3000" in machine and the request can be succesfull. |
In my case , i am creating server with "https" i.e https://localhost:4000/graphql , so when i accessing server from react-native using apollo it throws error like Network error: Network request failed . It work fine with "http". |
@emmanuelnk i use OpenSSL certificate and key at server side for creating https server. but at client side i am not able to use https ..can you please help me. i want to use https for server like this https://localhost:4000/graphql |
Is there anyone that was able to resolve th is issue? |
|
Any luck with this @smithaitufe? I have the same setup, the server receives the request but no response. Only "Network request failed". |
@plantryan @smithaitufe just in case you are still interested, I was blocked by this issue while uploading an image on android only becasue I was not setting the mime type which is only mandatory on android. |
thank you @emmanuelnk
|
This is working for me. Thank you! |
I'm create an example react-native app to use apollo, and connect to
https://my.domain.name/graphql
, It's work on iOS simulator but when i running on Android Emulator or Android physical device it doesn't works, error is appear like thisthis's my code
and this query
The text was updated successfully, but these errors were encountered: