question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS.MetadataService ignores httpOptions timeout

See original GitHub issue

Confirm by changing [ ] to [x] below to ensure that it’s a bug:

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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ajredniwjacommented, Jan 15, 2020

@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.

0reactions
github-actions[bot]commented, Oct 27, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class: AWS.MetadataService — AWS SDK for JavaScript
Represents a metadata service available on EC2 instances. ... httpOptions (map) — ... timeout (Number) — a timeout value in milliseconds to wait...
Read more >
Class: AWS.EC2MetadataCredentials
This credentials class will by default timeout after 1 second of inactivity and retry 3 times. If your requests to the EC2 metadata...
Read more >
Troubleshoot "Waiting for the metadata service" errors - AWS
My Amazon Elastic Compute Cloud (Amazon EC2) Windows instance is unable to retrieve instance metadata. How can I fix this? Resolution. My EC2...
Read more >
Use IMDSv2 - Amazon Elastic Compute Cloud
Use Instance Metadata Service Version 2 (IMDSv2) to access instance metadata from an Amazon EC2 instance.
Read more >
node-npmtest-aws-sdk/aws-sdk/lib/credentials
If your requests to the EC2 metadata service are timing out, you can increase ... EC2MetadataCredentials({ * httpOptions: { timeout: 5000 } ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found