superagent-jsonp
superagent-jsonp copied to clipboard
TypeError: Cannot read property 'push' of undefined
I'm getting this error while using jsonp on node.js
TypeError: Cannot read property 'push' of undefined
at Request.end ((path_to_project)/node_modules/superagent-jsonp/dist/superagent-jsonp.js:67:15).
On line 36 in the source code, it is trying to push to this._query
, which is undefined. I don't see this._query
initialised. That's causing issues, may be?
BTW, This error is thrown only when I'm running this on node.js, it works fine in browser.
Here is my code:
superagent
.get(baseUrl + '/rest/v2/me/mini')
.use(jsonp({
timeout: 5000
}))
.set('Cookie', cookieString)
.set('Accept', 'application/json')
.then((res) => {
resolve(res);
})
.catch((error) => {
resolve('notSigned');
});