question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

makeFeedRequest with GZIP throws Error: "incorrect header check"

See original GitHub issue

Running the document.getInfo(function(err, data) {}) function is resulting in an exception being thrown by browserfy-zlib. This can be traced back to the request from the makeFeedRequest() function. makeFeedRequest specifies gzip: true in the request, which is causing the failure. Manually removing gzip:true resultings in the api working as expected. Below is how i am utizliing the google-spreadsheets api.

I have a the following wrapper API to turn the callbacks into promises:

const GoogleSheetsAPI = () => {
    return {
        authorize: (sheetsId, credentials) => new Promise((resolve, reject) => {
            if (typeof credentials == 'undefined') {
                credentials = require(CREDENTIALS_PATH)
            }
            const doc = new GoogleSpreadsheet(sheetsId);
            doc.useServiceAccountAuth(credentials, (err) => {
                if (err) reject(err);
                resolve(doc);
            });
        }),
        load: (doc) => new Promise((resolve, reject) => {
            console.log('getting doc info')
            doc.getInfo(function(err, data) {
                if (err) reject(err);
                resolve(data);
            });
        })
    }
}

`

And call this later by:

      gsheetsAPI.authorize(sheetId);
            .then(doc => gsheetsAPI.load(doc))
            .then(data => {
                   //DO STUFF
             })
            .catch(err => console.log(err))

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
laurenzcodescommented, Sep 13, 2019

For anyone looking for how to get it to work: Initialize the doc like this const doc = new GoogleSpreadsheet('<Spreadsheet ID>', null, { gzip: false })

0reactions
gwendorffcommented, Dec 9, 2019

Thanks a lot!, now it’s working fine !

For anyone looking for how to get it to work: Initialize the doc like this const doc = new GoogleSpreadsheet('<Spreadsheet ID>', null, { gzip: false })

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect header check error - node.js - Stack Overflow
I am passing my own gzipped url in the code. Any help will be really useful. Thanks. node.js · http · request ·...
Read more >
Incorrect header check - Questions - Kong Nation
I'm trying to send request throw postman and I'm getting the error incorrect header check, but if I send curl request I get...
Read more >
3 while decompressing: incorrect header check - zlib.error
PYTHON : zlib. error : Error -3 while decompressing: incorrect header check [ Gift : Animated Search Engine ...
Read more >
java.util.zip.ZipException: incorrect header check - JRDC2 B4J
zip, an exception will be thrown if the header is wrong. this usually means the stream was compressed using gzip,not zip. the stream...
Read more >
Incorrect header check error when trying to use pako to ungzip ...
Because there are potentially tens of thousand of data points to optimize load times I'm compressing data using python gzip module. Since the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found