axios
axios copied to clipboard
Network Error in React Native
Describe the bug
When i'm POSTa request then in the processing i'm switch to another app (before i'm receive response from server) then when i'm come back it say Network Error is anyone have the same issue and know the way to deal with this problem?
To Reproduce
No response
Code snippet
No response
Expected behavior
No response
Axios Version
^1.6.2
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
iOS 16.4
Additional Library Versions
RN 0.71.8
React 18.2.0
Additional context/Screenshots
No response
I'm getting the same error, but only from Android. I don't think this is related to Axios because I used the bare JavaScript fetch method and the API call just never resolves.
I'm getting the same error, but only from Android. I don't think this is related to Axios because I used the bare JavaScript fetch method and the API call just never resolves.
I'm stuck at this problem for like 1 week. Some people say that axios isn't using an API that called NSURLSession provide by Apple to make a request so when user switch to another app the OS just cancel that request.
I'm getting the same error, but only from Android. I don't think this is related to Axios because I used the bare JavaScript fetch method and the API call just never resolves.
I'm stuck at this problem for like 1 week. Some people say that axios isn't using an API that called
NSURLSessionprovide by Apple to make a request so when user switch to another app the OS just cancel that request.
Honestly, in my case, I'm convinced that this is a backend problem. I created a basic Node.js backend and made a similar API call to it; everything was working just fine. We are looking into the issue and will keep you updated if we figure this out.
@nkqdev If it's GET data, if fetch data error, it should have chance to retry few times. check this article 3 Tips to Make Your App More Stable
@kurucaner And the android error, I think it's because you use '127.0.0.1' or 'localhost', I met this error before, and change the local IP to LAN ip(for example, like 192.168.1.10), then it's worked.
I use expo and this is how I get LAN ip in dev mode:
import Constants from 'expo-constants';
const host = Constants.expoGoConfig?.debuggerHost?.split(':')?.[0];
const API_URL = process.env.EXPO_PUBLIC_API_URL || '';
export const baseURL =
host &&
(host.startsWith('192.168') || host.startsWith('10.') || host.startsWith('172.')) &&
(API_URL.indexOf('localhost') > -1 || API_URL.indexOf('127.0.0.1') > -1)
? 'http://' + host + ':' + (API_URL.split(':').pop() || '')
: API_URL;
@suhaotian I'm using SOAP service so when it's say Network Error everything just stop and i don't see any retry
same issue ,any resolution?
Em facing the same issue ....!
Em facing the same issue ....!
Facing the same problem, any solution?
Guys I found solution. Its not axios problem. You need add certificates into your network_security_config
Also add android:usesCleartextTraffic="true"
Also add xml folder into your res/ and paste this code:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="@raw/ca" />
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
After that you need add your certificates into res/raw/NAME_OF_CERT
That's all!
@nkqdev @kurucaner @MenamAfzal @vivek0046
@TimeForRelax how can i get the certificates?
Trying this..
On Wed, Aug 28, 2024 at 8:56 PM Full Stack Developer < @.***> wrote:
@TimeForRelax https://github.com/TimeForRelax how can i get the certification?
— Reply to this email directly, view it on GitHub https://github.com/axios/axios/issues/6302#issuecomment-2315671219, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQEV3G67RCLUUCFXQKWPMLZTXT3BAVCNFSM6AAAAABEXUUFBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVGY3TCMRRHE . You are receiving this because you were mentioned.Message ID: @.***>
-- Vivek Rana
Founder
3Sigma Sales platform +91 8814048362 <+91+8814048362> @.*** www.3sigmacrm.com Magnum towers, Sector 58, Gurgaon [image: facebook] https://facebook.com/3sigma [image: twitter] https://twitter.com/3sigmacrm [image: linkedin] https://www.linkedin.com/company/71206402
https://www.hubspot.com/email-signature-generator?utm_source=create-signature
certificates
You need ask your backend guys
@TimeForRelax thanks for your information I will try it
Get an ssl certificate from aws. I think it's free of cost
On Thu, 29 Aug 2024, 12:22 nkqdev, @.***> wrote:
@TimeForRelax https://github.com/TimeForRelax thanks for your information I will try it
— Reply to this email directly, view it on GitHub https://github.com/axios/axios/issues/6302#issuecomment-2316842601, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQEV3GSI5EYOHIBZCYFUMDZT3AKFAVCNFSM6AAAAABEXUUFBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJWHA2DENRQGE . You are receiving this because you were mentioned.Message ID: @.***>