contentful.getEntries() throws "Error: unexpected end of file at Zlib._handle.onerror (zlib.js:370:17)"
See original GitHub issue- Node Version: v6.9.4
- Npm Version: 3.10.10
- Platform: Linux 2109406ca117 4.4.16-boot2docker #1 SMP Fri Jul 29 00:13:24 UTC 2016 x86_64 GNU/Linux (Official
debian:jessie-slim
image from https://hub.docker.com/_/debian/) - Package Version: contentful@3.8.0
I am building within a Docker container pulled from the official debian:jessie-slim image, with Node v6.9.4 installed from http://deb.nodesource.com/node_6.x. I have been getting the following error on on ~90% builds:
root@2109406ca117:/investors# node app.js
events.js:160
throw er; // Unhandled 'error' event
^
Error: unexpected end of file
at Zlib._handle.onerror (zlib.js:370:17)
The simplest code to reproduce this issue is below; interestingly, when the client.getContentTypes()
call is removed, the error occurs with noticeably less frequency:
const contentful = require('contentful');
let client = contentful.createClient({
accessToken: '',
space: ''
});
client.getContentTypes().then(values => {
client.getEntries({content_type: 'page'}).then(entries => console.log(entries));
});
From what I can tell, this seems to be an issue when chunks of data are dropped from gzipped responses and/or gzip response aren’t properly deflated. This would seem to align with the reduced error rate when the additional API call is removed. Here are a few issues that reported similar issues, with fixes referenced:
- https://github.com/mzabriskie/axios/issues/435
- https://github.com/request/request/issues/2197
- https://github.com/nodejs/node/issues/8701
Some solutions have included more lenient gzip decompression, and providing an option to disable gzip.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (7 by maintainers)
@andrewodri any time, I will close this issue for and feel free to create a new issue whenever you have a problem to report
Hi @andrewodri , This is really weird I never seen this happening, I will try to reproduce this using Docker and come back to you asap, but mostly could be related to axios. Best, Khaled