Skip to content

Conversation

@siddsriv
Copy link
Contributor

@siddsriv siddsriv commented Dec 9, 2025

Issue

#7357

Description

Bubbles up status code for users to access in case of errors when making an IMDS request().

Testing

Minimal repro:

import { MetadataService } from '@aws-sdk/ec2-metadata-service';

try {
    const metaService = new MetadataService({});
    await metaService.request(`/latest/meta-data/DNE`, {});
} catch (e) {
    console.log(e.statusCode)
    console.log(e.message)
}

Before the fix:

undefined
Error making request to the metadata service: Error: Request failed with status code 404

After the fix:

404
Error making request to the metadata service: Error: Request failed with status code 404

Unit tests in the package are passing.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@siddsriv siddsriv requested a review from a team as a code owner December 9, 2025 20:06
@siddsriv
Copy link
Contributor Author

Canonical PR (upstream) for this fix here: #7564. Closing this one.

@siddsriv siddsriv closed this Dec 10, 2025
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

Successfully merging this pull request may close these issues.

1 participant