Skip to content
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

jwt retry changes in v1.31.0 encounter undefined #476

Closed
lukesiler opened this issue Feb 24, 2020 · 4 comments
Closed

jwt retry changes in v1.31.0 encounter undefined #476

lukesiler opened this issue Feb 24, 2020 · 4 comments

Comments

@lukesiler
Copy link

  • [ x] I have checked that the [SDK documentation][sdk-docs] and [API documentation][api-docs] doesn't solve my issue

Description of the Issue

When JWT retry code is triggered, an undefined property exception occurs trying to read hasOwnProperty

Versions Used

Node SDK: v1.31.0
Node.js: node:12.13-stretch-slim

Steps to Reproduce

use box-node-sdk to download files via files.getReadStream and occasionally a JWT AuthError will occur triggering retry.

Error Message, Including Stack Trace

TypeError: Cannot read property 'hasOwnProperty' of undefined at APIRequest._retry (/opt/pryon/contapp/node_modules/�[4mbox-node-sdk�[24m/lib/api-request.js:308:27) at APIRequest._handleResponse (/opt/pryon/contapp/node_modules/�[4mbox-node-sdk�[24m/lib/api-request.js:256:9) at self.callback (/opt/pryon/contapp/node_modules/�[4mrequest�[24m/request.js:185:22)
[sdk-docs]: ./docs
[api-docs]: https://developer.box.com/

@lukesiler lukesiler changed the title jwt retry changes in v1.31.0 introduced an un jwt retry changes in v1.31.0 encounter undefined Feb 24, 2020
@lukesiler
Copy link
Author

box-node-sdk/lib/api-request.js:308

} else if (err.response.hasOwnProperty('headers') && err.response.headers.hasOwnProperty('retry-after')) { } else if (err.response.hasOwnProperty('headers') && err.response.headers.hasOwnProperty('retry-after')) { TypeError: Cannot read property 'hasOwnProperty' of undefined at APIRequest._retry (/opt/pryon/contapp/node_modules/�[4mbox-node-sdk�[24m/lib/api-request.js:308:27) at APIRequest._handleResponse (/opt/pryon/contapp/node_modules/�[4mbox-node-sdk�[24m/lib/api-request.js:256:9) at self.callback (/opt/pryon/contapp/node_modules/�[4mrequest�[24m/request.js:185:22) [90m at Request.emit (events.js:210:5)�[39m at Request.onRequestError (/opt/pryon/contapp/node_modules/�[4mrequest�[24m/request.js:881:8) [90m at ClientRequest.emit (events.js:210:5)�[39m [90m at TLSSocket.socketOnEnd (_http_client.js:440:9)�[39m [90m at TLSSocket.emit (events.js:215:7)�[39m [90m at endReadableNT (_stream_readable.js:1184:12)�[39m [90m at processTicksAndRejections (internal/process/task_queues.js:80:21)�[39m

@sujaygarlanka
Copy link
Contributor

sujaygarlanka commented Feb 24, 2020

@lukesiler We have a fix for this and are in the process of implementing it. It seems that the response is not being returned. In an effort to figure out why this may be happening, do you mind logging err and response at the top of the _handleResponse method in the /box-node-sdk/lib/api-request.js file? This would be a huge help.

@sujaygarlanka
Copy link
Contributor

sujaygarlanka commented Feb 25, 2020

We merged the fix in this PR #477. We will do a release sometime in the next few weeks.

@lukesiler
Copy link
Author

lukesiler commented Feb 25, 2020

@sujaygarlanka - Thanks for the quick response and fix. I'll try to log those and will post here if I'm able to trap another occurrence.
It would be great to get a v1.31.1 release soon since this bug fix impacts the reliability of box interactions for all methods in the sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants