-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeJS crash with TypeError: Cannot read property 'error' of undefined #169
Comments
Hi @almacha |
The same error happened on the 2017-11-16 at 15:52:13 CET
|
@mguillau42 thanks for the logs.
If data was not returned then I think we would see this error. |
+1 |
ok, thanks for the update. |
Any updates on this? |
Hi @tarunbatra |
Same issue here:
Note that the callback function at line 141 is the same passed at line 138. Somehow, the
|
At least I suggest to avoid the crash #182 |
@eagleeye |
Just wanna send a +1 on this. Experiencing the same issue. Can't really say what circumstances are causing it. I'm getting it around these lines of ugly code :) ...
intercom.events.listBy({ type: 'user', intercom_user_id: intercomId }, (error, response) => {
if (!error) {
_.each(response.body.events, event => {
eventsList.push(event)
})
if (response.body.pages) {
this.getUserEventsWithPagination(
intercom,
intercomId,
eventsList,
failedFetches,
response.body.pages,
callback
)
} else {
callback(null, 'getUserEventsWithPagination all is good!')
}
} else {
if (_.isEqual(error.statusCode, 429)) {
console.log('getUserEventsWithPagination ' + error.statusMessage)
}
callback(
{
code: 'ERROR_CAUGHT',
message: 'Error on the first try...',
},
null
)
}
})
... Specifically.. ...
} else {
if (_.isEqual(error.statusCode, 429)) {
console.log('getUserEventsWithPagination ' + error.statusMessage)
}
callback(
{
code: 'ERROR_CAUGHT',
message: 'Error on the first try...',
},
null
)
}
... Where I'm seeing |
I also have this issue. OS is Redhat and node version |
Also experienced this today, package version 2.9.2 on Node 8.9.4. It was while doing a I'm seeing that an This line, reproduced here: this.request(args, (_, r) => {
callbackHandler(resolver, r);
}); seems to be ignoring the possible error passed to the callback and instead binding it to this.request(args, (err, r) => {
if (err) {
doSomethingElse();
} else {
callbackHandler(resolver, r);
}
}); Ideally the error branch of this would be something like |
We use Again, totally agree with @LewisJEllis that
Hope, it will be fixed soon. |
I just wanted to note that we are actively looking at this issue. |
Fix for #169 (TypeError: Cannot read property 'error' of undefined)
I'm experiencing the same issue with intercom on shopify. Is there any fix for this already? |
I am going to close this issue since I am unable to repro it and we have been unable to confirm that it is still occurring. Please feel free to open another issue if anyone sees this occurring or a similar issue. It might be easier to track it as a separate issue |
Version info
Expected behavior
not to crash
Actual behavior
crashes our nodejs application entirely
Steps to reproduce
I don't know how to reproduce the bug but it seems to be incorrect error handling. Perhaps when the API returns some unexpected data? This happened at 2017-11-02 20:16 CET. But it does not happen any more.
Logs
TypeError: Cannot read property 'error' of undefined
1
at callback (/var/app/current/node_modules/intercom-client/dist/client.js line 221 col 29)
var hasErrors = data.error || data.body && data.body.type === 'error.list';
2
at Request._callback (/var/app/current/node_modules/intercom-client/dist/client.js line 137 col 13)
callbackHandler(resolver, r);
3
at self.callback (/var/app/current/node_modules/request/request.js line 186 col 22)
self._callback.apply(self, arguments)
4
at emitOne (events.js line 96 col 13)
5
at Request.emit (events.js line 188 col 7)
6
at Request.onRequestError (/var/app/current/node_modules/request/request.js line 878 col 8)
self.emit('error', error)
7
at emitOne (events.js line 96 col 13)
8
at ClientRequest.emit (events.js line 188 col 7)
9
at TLSSocket.socketErrorListener (_http_client.js line 309 col 9)
10
at emitOne (events.js line 96 col 13)
11
at TLSSocket.emit (events.js line 188 col 7)
12
at emitErrorNT (net.js line 1277 col 8)
13
at (/var/app/current/node_modules/async-listener/glue.js line 188 col 31)
var returned = original.apply(this, arguments);
14
at _combinedTickCallback (internal/process/next_tick.js line 80 col 11)
15
at process._tickDomainCallback (internal/process/next_tick.js line 128 col 9)
16
at process.fallback (/var/app/current/node_modules/async-listener/index.js line 539 col 15)
return fn.apply(this, args || arguments);
The text was updated successfully, but these errors were encountered: