AWS.MetadataService ignores httpOptions timeout
See original GitHub issueConfirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve gone though Developer Guide and API reference
- I’ve checked AWS Forums and StackOverflow for answers
- I’ve searched for previous similar issues and didn’t find any solution
Describe the bug The node.js version of MetadataService ignores the timeout option. This is a repeat of issue #485 but is caused by a new reason. A clear and concise description of what the bug is.
Is the issue in the browser/Node.js? Node.js
If on Node.js, are you running this on AWS Lambda? No
Details of the browser/Node.js version v13.5.0
SDK version number aws-sdk@2.595.0
To Reproduce (observed behavior) Run this on a local developer box (not somewhere with access to the metadata service):
const md = new AWS.MetadataService({ httpOptions: { timeout: 5000 } })
const request = util.promisify(md.request).bind(md)
await request('/latest/user-data')
Expected behavior This should timeout after 5s, instead it takes 60s.
Additional context So, since the last time I fixed this, the request system has changed and timeout is no longer the correct option to use. MetadataService ends up calling to AWS.NodeHttpClient#handleRequest which uses two different timeout options – connectTimeout (initial connect timeout) and timeout (timeout between bytes received in an active connection). If you change my calling code to pass connectTimeout instead of timeout it behaves as expected. I wasn’t sure how the browser-based http clients implemented this, so wasn’t sure of the correct way to fix it (is it a documentation issue or an implementation issue, complicated by backwards-compatibility concerns). Happy to create a PR if someone can give me guidance on the desired fix.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
@mdouglass thank-you for reaching out to us with your issue.
The team would be happy to review the PR, for guidance would need additional review on how to fix the issue, can look into it deeply and come up with a possible solution.
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.