box / box/box-node-sdk

Provide a way to set timeout on requests made by `box-node-sdk`

Open
#871 3 comments 0 reactions 6 assignees Claimed by @mwwoda View on GitHub
enhancement
Dominant language
TypeScript
Stars
199
Forks
123
Avg merge
1d 1h
Merged PRs (30d)
20

Description

### Is your feature request related to a problem? Please describe.
Currently the sdk sets no default timeout and provides no official configuration option to limit the request timeout. From `@cypress/request` [documentation](https://www.npmjs.com/package/@cypress/request#timeouts) regarding timeouts:

> Most requests to external servers should have a timeout attached, in case the server is not responding in a timely manner. Without a timeout, your code may have a socket open/consume resources for minutes or more.

During a recent Box outage our application requests were blocked by calls made by the sdk, which by default, retries 5 times before failing. We will reduce number of retries (which is configurable) but would also like a way to limit the request timeout.

### Describe the solution you'd like
It would be great if we could set timeout per request (specifically for us - [`getAppUserTokens`](https://rawgit.com/box/box-node-sdk/main/docs/jsdoc/BoxSDKNode.html#getAppUserTokens)), but being able to set it globally in `configure` is also helpful.
Currently only `uploadRequestTimeoutMS` is officially supported -
https://rawgit.com/box/box-node-sdk/main/docs/jsdoc/global.html#UserConfigurationOptions

### Describe alternatives you've considered
This is our current workaround -
```
this.boxSdk.configure({
numMaxRetries: 2,
request: { timeout: 2000 },
});
```

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.