node-zendesk
node-zendesk copied to clipboard
After upgrade to v2.0.1: zendeskClient.tickets.incrementalInclude never calls back
Issue #275 was never fully resolved for me. The changes @jondcoleman made in PR #278 helped eliminate TypeError: Cannot read property 'options' of undefined
but now a call to zendeskClient.tickets.incrementalInclude
simply hangs and the callback is never called.
Example:
zendeskClient.tickets.incrementalInclude(0, 'metric_sets', function(err, statusList, body, responseList, resultList) {
console.log(err);
console.log(resultList);
});
Expected behavior: The callback is called with an error or resultList
Actual behavior: Callback is never called
This code works for me on 2.0.1 so I'm not sure what you have going on. See this screen recording.
Here's a screen recording showing the differences between 1.4.0 and 2.0.3
https://user-images.githubusercontent.com/107733/105110285-e8548180-5a83-11eb-802f-f4ed60e9b594.mp4
I think the difference is that I'm expecting a single page of results to be returned along with an end_time
that we store and use on subsequent calls to get the next page of results. At least, that's how I understand the API should work from the Zendesk docs: https://develop.zendesk.com/hc/en-us/articles/1500000071922#time-based-incremental-exports
Is it possible that the behavior has changed and zendeskClient.tickets.incrementalInclude is now trying to aggregate all results until it returns?
Yeah, the incremental include function does try to do that, via the requestAll method from what I can see.
Upgrading to node-zendesk 2.1.0 has not fixed this issue.
Executing the code in the initial comment now yields an error, though. Here it is:
Error: Zendesk rate limits 200 requests per minute
at checkRequestResponse (/Users/meverett/GitHub/runbook/util/node_modules/node-zendesk/lib/client/client.js:287:13)
at requestCallback (/Users/meverett/GitHub/runbook/util/node_modules/node-zendesk/lib/client/client.js:310:3)
at Request._callback (/Users/meverett/GitHub/runbook/util/node_modules/node-zendesk/lib/client/client.js:128:14)
at Request.self.callback (/Users/meverett/GitHub/runbook/util/node_modules/request/request.js:185:22)
at Request.emit (node:events:390:28)
at Request.<anonymous> (/Users/meverett/GitHub/runbook/util/node_modules/request/request.js:1154:10)
at Request.emit (node:events:390:28)
at IncomingMessage.<anonymous> (/Users/meverett/GitHub/runbook/util/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:509:28)
at IncomingMessage.emit (node:events:402:35) {
statusCode: 429,
result: <Buffer 7b 22 65 72 72 6f 72 22 3a 22 41 50 49 52 61 74 65 4c 69 6d 69 74 45 78 63 65 65 64 65 64 22 2c 22 64 65 73 63 72 69 70 74 69 6f 6e 22 3a 22 4e 75 6d ... 68 more bytes>,
retryAfter: '13'
}
Executing the exact same script with versions prior to v2.x return the expected array of results + the continuation information (end_of_stream, next_page and end_time) with no errors.
Update: Actually, v1.4 is the last known-good version. v1.5 simply exits silently without executing the callback or throwing an error.