Open amabdul opened 5 years ago
Trying console.log
ging that response.originalError
... that should shed some light on things. That's the underlying axios
error. the status: null
would mean that that server was not reached (whether that's a network issue or a server not responding, we can't really know).
Can I implement retry logic for the same request, if I got the specific error. Would something like this work with apisauce: axios/axios#934.
You can access the axiosInstance after creating an api by doing api.axiosInstance
. That way you have full access to everything they can do.
hi I wrote like this
api.axiosInstance.interceptors.response.use(function (response) { if (response.data) { // for NETWORK_ERROR data will be null console.log('interceptors response success', response) } else { console.log('interceptors response error', response) return api.axiosInstance.request(response.config); } return response; }, function (error) { return Promise.reject(error); })
I always get log 'interceptors response success' for fine calls. But nothing got logged for NETWORK_ERROR. Means not intercepted for this error. Why is that?
I believe axios treats that as an exception, so perhaps doesn't take the interception route home? I haven't tried that before so I can't say for sure.
how we can effectively debug the issue. to find who is responsible for the error is it the apisause OR actually the server do apisause has the issue "for some request whether it end up in NETWORK_ERROR"
NETWORK_ERROR
is set from apisauce
. It makes that decision by investigating the response value from the axios
exception. That's the originalError
property that comes back when you make that call.
Everything that apisauce knows comes from that, so if you have a look at that error message and stack trace closely, that might give you some more info.
In your original post, I see something like blob
in there. That's the new blob support that's in React Native 53 or 54 (I can't remember), so that's throwing a little bit of obfuscation into the mix as well.
Getting access to the server logs can help too (not sure if that's an option for you or not).
Lack of a good error message certain is frustrating to track down.
When I try to fetch data sometimes I am getting the error, most of the time works fine. If it generate error once, the chance of occurence is high, in the immediate call.
The error log in the chrome debugger is:
{duration: 126, problem: "NETWORK_ERROR", originalError: Error: Network Error at createError (blob:http://10.0.0.59:8081/f5cf0951-79a8-4e8c-9a37-0013ae13…, ok: false, status: null, …}
react-native-cli: 2.0.1 react-native: 0.55.4
I am not getting why the error occur for the same success request. The network is reachable. Since it occur sometime its become a headache. Please help
Even i am facing the same issue...........
Can someone please post the solution if u get any info about this?
Check your network connection... I had the same problem hahaha
I am having same issue @keerthi0611 are you able to solve it?
@waleedarshad Check your network connection . Maybe your device is disconnected.
My network is good, but I still get "problem":"NETWORK_ERROR" "status": null
Guys, sadly I'm here for the same reason. NETWORK_ERROR pops out without any clue. I've noticed that it depends on the machine whom listens the requests. But couldn't realize any possible cause.
+1
+1
I get the NETWORK_ERROR in react-native v0.61.5 on iOS if I minimize the app during the request before a response is received. The request however still reaches the server but axios reports an NETWORK_ERROR with status: null
. Any ideas why this happens and how to solve it?
I have same issue NETWORK_ERROR with status: null
I facing the same NETWORK_ERROR problem ,
"originalError": [Error: Network Error],
"problem": "NETWORK_ERROR",
"status": null,
I had same issue NETWORK_ERROR status: null. So, You should try: ipconfig in powershell and get the ipv4. You have to change localhost:port to your ipv4:port
THE SOLUTION is: on Android you need to specify the file path with file:// as prefix. So do like this:
const audio = {
uri: 'file://' + this.recorder.fsPath,
type: 'video/mp4',
name: filename
}
Good Luck
Had this issue. I was following a tutorial that was using an emulator, but I was using a real device for my testing.
ipconfig to get your IPv4 for your apisauce client baseURL.
such as: baseURL: "http://199.199.9.90:8000/api",
setup your django API not on localhost (as this can't be accessed from a real device).
python manage.py runserver 0.0.0.0:8000
good luck!
@amabdul did you come right ? so we can close this ?
I have the same issue, even in my baseURL I have used my machine ipv4 address instead of localhost but still the problem remains
So I had a similar issue and it was because I was sending the date to my APS .net backend but the date wasn't in a string format. When I converted my date to a string then the request went through.
Check the data, I had the same problem and noticed that a variable in my data was undefined
Well, I tried all of the possibilities, I used the correct IPv4, IPv6, './listings/, localhost. I also downloaded the zipped files and tried them, every time I got “problem”: “NETWORK_ERROR”. Is there somebody who resolved the problem?
The response of the request: Object { “config”: Object { “adapter”: [Function xhrAdapter], “baseURL”: “http://192.168.0.10:9000/api”, “data”: undefined, “headers”: Object { “Accept”: “application/json”, }, “maxContentLength”: -1, “method”: “get”, “params”: Object {}, “timeout”: 0, “transformRequest”: Array [ [Function transformRequest], ], “transformResponse”: Array [ [Function transformResponse], ], “url”: “/listings”, “validateStatus”: [Function validateStatus], “xsrfCookieName”: “XSRF-TOKEN”, “xsrfHeaderName”: “X-XSRF-TOKEN”, }, “data”: null, “duration”: 69619, “headers”: null, “ok”: false, “originalError”: [Error: Network Error], “problem”: “NETWORK_ERROR”, “status”: null, }
So I had a similar issue and it was because I was sending the date to my APS .net backend but the date wasn't in a string format. When I converted my date to a string then the request went through.
Same here, apisauce doesnt even send the request at all, just returns NETWORK_ERROR because the payload is malformed - needs better handling.
When I try to fetch data sometimes I am getting the error, most of the time works fine. If it generate error once, the chance of occurence is high, in the immediate call.
The error log in the chrome debugger is:
{duration: 126, problem: "NETWORK_ERROR", originalError: Error: Network Error at createError (blob:http://10.0.0.59:8081/f5cf0951-79a8-4e8c-9a37-0013ae13…, ok: false, status: null, …}
react-native-cli: 2.0.1 react-native: 0.55.4
I am not getting why the error occur for the same success request. The network is reachable. Since it occur sometime its become a headache. Please help