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

Information about AWS ec2 instance metadata credentials #38

Open
soundstep opened this issue Jan 20, 2023 · 8 comments
Open

Information about AWS ec2 instance metadata credentials #38

soundstep opened this issue Jan 20, 2023 · 8 comments

Comments

@soundstep
Copy link

soundstep commented Jan 20, 2023

Hi,

This is not a feature request, but it wasn't a bug either.
In case anyone has some insights, it would be greatly appreciated.

I just noticed that using an esm.sh based url:
https://esm.sh/@aws-sdk/client-s3@3.254.0
Instead of:
https://deno.land/x/aws_sdk@v3.32.0-1/client-s3/mod.ts
The instance metadata credentials are not being picked up:

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

Similar issue

As with the deno.land/x/aws_sdk module I did not have to set up anything special in terms of credentials, I don't see why I would need to set up a credentials provider manually.

Has something been done in this repo?
Any clue of what could be the issue?

@soundstep soundstep changed the title Information about AWS OIDC Information about instance metadata credentials Jan 20, 2023
@soundstep soundstep changed the title Information about instance metadata credentials Information about AWS ec2 instance metadata credentials Jan 20, 2023
@soundstep
Copy link
Author

I've corrected the title and body, we are not using OIDC but EC2 metadata credentials.

@christophgysin
Copy link
Owner

Most of the logic in this repo stems from https://github.com/christophgysin/aws-sdk-js-v3/blob/deno/scripts/generate-clients/copy-to-deno.js.

Did you get an older version to work using esm.sh? This port is mostly abandoned after aws-sdk started delegating a lot of the work to a new depdendency aws-crt, see also #28.

@soundstep
Copy link
Author

soundstep commented Jan 23, 2023

@christophgysin What do you mean by "a port"? I thought esm.sh were just blindly transpiling from the URL which contains the version you are requesting?

I just constructed this URL: https://esm.sh/@aws-sdk/client-s3@3.254.0, and I seem to be able to import the dependencies but no I haven't got something working with it.

I started looking into it when we had an issue bundling with aws-sdk-js-v3 (which resolved on its own it seems):

Download https://jspm.dev/npm:@aws-sdk/util-utf8-browser@3!cjs
Download https://jspm.dev/npm:tslib@1.14.1!cjs
Download https://jspm.dev/npm:@aws-sdk/util-utf8-browser@3.29.0!cjs
Download https://deno.land/std@0.119.0/node/querystring.ts
error: Module not found "https://jspm.dev/npm:@aws-sdk/util-utf8@3.254.0".
    at https://jspm.dev/@aws-sdk/hash-node:4:8
The command '/bin/sh -c deno cache lib/docker.ts' returned a non-zero code: 1

I also don't know if that's normal but the last tag on this repo is on on Dec 27, 2021.

Can you advise about what is the right thing to do (future-proof) with aws-ask for deno?
Keep using aws-sdk-js-v3 or switch to a more "on-the-fly" transpiling with esm.sh or similar?

Cheers.

@christophgysin
Copy link
Owner

There is some misunderstanding here.

The original source is at https://github.com/aws/aws-sdk-js-v3. From there, every package is published to npm, e.g. https://www.npmjs.com/package/@aws-sdk/client-s3.

esm.sh is transpiling automatically from npm, and provides the result at https://esm.sh/@aws-sdk/client-s3.

This repo is a fork of https://github.com/aws/aws-sdk-js-v3, that translates the code to deno APIs, and publishes the result to https://deno.land/x/aws_sdk. Unfortunately aws-sdk started to split out low level functionality to aws-crt, see #28.

If you're willing to help getting this fork to work with aws-crt (or find a way around it), let me know.

Otherwise you can ask esm.sh for help with their autogenerated port, but I can imagine most functionality won't work out of the box, and they are more focused on translating as many simple packages as possible instead of perfecting a single one (aws-sdk).

Or go knock on AWS doors to allow directly maintaining a deno port in the upstream repo, similar to how they currently support node and browser.

@soundstep
Copy link
Author

Hey @christophgysin, thanks for clarifying all this.
I haven't checked yet what aws-crt is, I'll have a look.
I'll try a few things with the esm.sh version, I'll give this a shot:
aws#1289 (comment)
I keep you posted, cheers.

@soundstep
Copy link
Author

soundstep commented Jan 26, 2023

Hey @christophgysin,

Did you get an older version to work using esm.sh? This port is mostly abandoned after aws-sdk started delegating a lot of the work to a new depdendency aws-crt, see also #28.

Can you clarify what you meant by "this port", are you talking about this fork or any esm.sh usage?

I'm after what is the most reliable and future-proof usage for the AWD SDK with Deno, as AWS does not provide an official port. We are porting some scripts in our CI and we want this part to be as stable as possible.

@christophgysin
Copy link
Owner

This fork is a port of the aws-sdk-v3 to deno. If I'm referring to "this port", I'm referring to this repository we are discussing in.

There is currently no reliable version of aws-sdk for deno.

@soundstep
Copy link
Author

Thanks for clarifying, I created another issue there:
aws#4405

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

No branches or pull requests

2 participants