aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.06k stars 573 forks source link

MetadataService ignoring timeout config #6042

Closed morwoen closed 4 months ago

morwoen commented 5 months ago

Checkboxes for prior research

Describe the bug

The MetadataService from @aws-sdk/ec2-metadata-service package ignores timeout config. The config is initialised in the constructor but is never retrieved from the object here or here.

SDK version number

@aws-sdk/ec2-metadata-service@3.565.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v18.18.2

Reproduction Steps

const metaData = new MetadataService({
    httpOptions: {
      timeout: 2000
    },
  });

return metaData.request('/latest/meta-data/placement/region', {})

The above has to be run locally where there is no metadata service access.

Observed Behavior

Code hangs for over 30 seconds

Expected Behavior

After 2 seconds the code should return a rejected promise

Possible Solution

The config needs to be passed down to the HttpRequest.

Additional Information/Context

No response

RanVaknin commented 4 months ago

Hi @morwoen ,

Thanks for letting us know. This seems like an oversight. @siddsriv is taking a look.

All the best, Ran~

siddsriv commented 4 months ago

thanks for reporting this, timeout config option been added for requests. closing this issue, feel free to create a new one if you encounter any other issues.

morwoen commented 4 months ago

Thanks @siddsriv , could you confirm which version the fix is in?

morwoen commented 4 months ago

Found it :) https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.574.0

github-actions[bot] commented 4 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.