Uncaught (in promise) Error: invalid response body at: http://xxx/latest?from=11&size=10 reason: data error: incorrect header check(…)
I'm very confused by this. I can get this working fine through PHP's local server, but as soon as I run it through an nginx server, I get this error message. The browser (both Chrome and Firefox) show me the correct request and response headers, and even returned content in the Network panel, but the request is still discarded in favour of an error by this JS.
Any insight as to what this may be?
I think this may be related, but sadly I am not a node person, so don't know what it means for this library.
The only header difference between the servers is the content encoding being gzip on nginx.
http://stackoverflow.com/questions/19438884/incorrect-header-check-when-using-zlib-in-node-js
I'll add that this code is packaged together using Browserify to be used in a browser, if that helps.
Chrome and Firefox don't use the polyfill code, so this must be something in the browser or server. You might try using curl -i to test the URL and view the response headers.
@designermonkey Did you ever find a solution? I started running into the same situation today.
Error: invalid response body at: reason: data error: incorrect header check
at Gunzip.at Gunzip.
at Gunzip.EventEmitter.emit
at Zlib.mode._binding.onerror
at Zlib._error)
at Zlib._write)
at Item.run at drainQueue
Edit: I was able to use isomorphic-fetch to get around the issue. Which makes sense in the end.
@rossthedevigner How did you get around the problem with isomorphic-fetch? I keep getting the same error.
In case this is useful to anyone else: I was accidentally setting the content-encoding header on the server to an encoding (gzip) that was different to the actual response (br). So then the client (which in this case is node-fetch) tries to decompress a br-encoded response using gzip. At least I'm pretty sure that's what was happening. Edit: Just realised this is the github/fetch repo and not node-fetch. Leaving this comment here anyway because it seems half-relevant and it might be useful for other noobs like me.
Most helpful comment
@rossthedevigner How did you get around the problem with isomorphic-fetch? I keep getting the same error.