falcor icon indicating copy to clipboard operation
falcor copied to clipboard

value is "message": "Response code 0"

Open mickael-kerjean opened this issue 9 years ago • 3 comments

Hello,

I start to put my head on falcor and wow I'm impress (love the query optimizer, LRU, subscribe). It kick ass so much that I wonder how is it possible nobody went with this solution before.

I'm using falcor router and I keep receiving this kind of error message:

{
        "path": [
            "....."
        ],
        "value": {
            "message": "Response code 0"
        }
},

It seems to happen randomly in my code. Any idea of what situation make this error happen?

mickael-kerjean avatar May 13 '16 09:05 mickael-kerjean

My assumption is that your underlying service is throwing this error.

jhusain avatar May 13 '16 23:05 jhusain

In the past, seems like I've seen XHR requests report response code of "0" when the network is down or the host is unreachable.

greim avatar May 14 '16 16:05 greim

@greim Thank you for puttting me on the track @jhusain Since the error is intermittent, It wasn't trivial to isolate the issue. First time I came into this, I didn't understand how it was possible to have a 0 since it isn't a valid HTTP status code. After browsing into the underlying service code I haven't found anything that could generate this error.

However, browsing into Falcor code, here is what I found: The error is generated here since the status property of the xhr object is 0 when the request complete. According to the xhr spec, it happens when:

  • the error flag is set (indicates some type of network error or fetch termination)
  • the state is UNSENT or OPENED

It would be great to manage this case somewhere in here so that if the service doesn't answer (which is the root cause of the issue I was experiencing), the error message provide by falcor make more sense.

mickael-kerjean avatar May 16 '16 05:05 mickael-kerjean