Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno port via esm.sh seems to have broken the AWS ec2 instance metadata credentials #4327

Closed
soundstep opened this issue Jan 20, 2023 · 1 comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@soundstep
Copy link

Describe the bug

I realise the following is not a NodeJS usage.

Using the AWS SDK with Deno using esm.sh: https://esm.sh/@aws-sdk/[email protected]
We can't seem to be able to pick the AWS ec2 instance metadata credentials.

Do we need to create a provider ourselves?

Any insights or help appreciated.

Expected Behavior

To have the AWS SDK logged in automatically.

Current Behavior

Throw an error:

00:00:02.791 Error: Credential is missing
00:00:02.791     at re.credentialProvider (https://esm.sh/v103/@aws-sdk/[email protected]/deno/client-s3.js:4:179910)
00:00:02.791     at re.signRequest (https://esm.sh/v103/@aws-sdk/[email protected]/deno/signature-v4.js:3:522)
00:00:02.791     at re.sign (https://esm.sh/v103/@aws-sdk/[email protected]/deno/signature-v4.js:2:4709)
00:00:02.791     at sign (https://esm.sh/v103/@aws-sdk/[email protected]/deno/signature-v4-multi-region.js:2:788)
00:00:02.791     at https://esm.sh/v103/@aws-sdk/[email protected]/deno/middleware-signing.js:2:2366
00:00:02.791     at async https://esm.sh/v103/@aws-sdk/[email protected]/deno/middleware-retry.js:2:5465
00:00:02.791     at async https://esm.sh/v103/@aws-sdk/[email protected]/deno/middleware-logger.js:2:34

Reproduction Steps

Create a deno file (send-file.ts) to execute some AWS actions:

import { S3Client } from 'https://esm.sh/@aws-sdk/[email protected]';

const client = new S3Client({ region: 'eu-west-1' });

await client.send(
        new CopyObjectCommand({
            Bucket:'my-bucket',
            CopySource: `my-bucket/my-file`,
            Key: 'new-file',
            TaggingDirective: 'REPLACE',
        }),
    );
deno run -A send-file.ts

Possible Solution

The only solution we found is that it seems to work this one:

import { S3Client } from 'https://deno.land/x/[email protected]/client-s3/mod.ts';

Repo source: https://github.com/christophgysin/aws-sdk-js-v3

But we get build errors from this repo, the esm.sh one should be more future-proof.

Additional Information/Context

I've asked some question there as well:
christophgysin/aws-sdk-js-v3#38

SDK version used

3.254.0

Environment details (OS name and version, etc.)

Linux / github actions / mac os 12.1

@soundstep soundstep added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 20, 2023
@soundstep
Copy link
Author

I will re-open this in this repo: https://github.com/aws/aws-sdk-js-v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant