-
Notifications
You must be signed in to change notification settings - Fork 594
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
Instance and container metadata credentials not working with Deno #4405
Comments
This was fixed in my fork using a custom implementation for deno: https://github.com/christophgysin/aws-sdk-js-v3/tree/deno/packages/credential-provider-imds-deno |
Oh great, thank you for the info! |
Am I wrong in thinking that the behavior I reported is related to the following package that is not working with Deno as it is using node bindings? |
Hi @soundstep, thanks for opening this issue. I was able to reproduce the reported behavior, however, I am not very familiar with Deno runtime, and I am currently working on understanding what exactly maybe causing the issue here. I will get back to you as soon as possible. Thanks! |
@soundstep did you find a solution? I am running into the same problem. If so, do you mind showing your updated code or package references? |
Hi @soundstep, @cdeck95, sorry for the delay answering on this. Basically, this issue is caused by the http library that deno uses, which seems to be different from the one nodejs provides and therefore the request sent is rejected by the imds. Since we do not support Deno runtime, one thing you folks can do is to do a custom implementation to fetch the credentials from the instance metadata service. Actually that is what @christophgysin did. Here is also the documentation. What I can do now is to mark this issue as feature request to gather community sentiments about this and take further actions based on it. Thanks! |
Thank you @yenfryherrerafeliz for looking into this. I think the reason why @christophgysin port has been abandoned is he cannot compile his sdk port anymore because of an underlying crt library, more info there: christophgysin#38 (comment) We have other EKS containers that run on web identity token, I will try to provide these credentials manually once I get the info I need to see how it goes. @cdeck95 No solution so far I'm afraid, FYI see the IMDS port from @christophgysin there. |
FYI, this works with web identity token in containers (EKS), the credentials are picked up correctly: import { ListObjectsCommand, S3Client } from 'npm:@aws-sdk/[email protected]';
const client = new S3Client({
region: Deno.env.get('AWS_REGION') || 'eu-west-1',
});
const res = await client.send(
new ListObjectsCommand({
Bucket: 'my-bucket',
}),
);
console.log('response length:', res.Contents.length); I'm not sure I will have the time to look into IMDS (container and instance metadata) for the time being, which is not working. |
another error that seems to be deno-specific: import * as s3 from 'npm:@aws-sdk/client-s3'
const s3_client = new s3.S3({
region: 'auto',
endpoint: R2_BASE_URL,
credentials: {
accessKeyId: ACCESS_KEY_ID,
secretAccessKey: ACCESS_KEY_SECRET,
}
})
const result = await s3_client.createMultipartUpload({
Bucket: 'MYBUCKET',
Key: `${Date.now()}`,
}) gives this error:
running the same snippet in node (with a few changes like removing the This is using R2 so dont crucify me 😅. This is how they would normally call your api from node https://developers.cloudflare.com/r2/reference/data-location/ [edit] one more datapoint: I can still successfully use the old sdk. // @deno-types="npm:aws-sdk/clients/s3.d.ts"
import aws_sdk_s3 from 'npm:aws-sdk/clients/s3.js';
const s3_client = new aws_sdk_s3({
accessKeyId: ACCESS_KEY_ID,
secretAccessKey: ACCESS_KEY_SECRET,
endpoint: R2_BASE_URL,
})
const result = await new Promise((resolve, reject) => {
s3_client.createMultipartUpload({
Bucket: 'MYBUCKET',
Key: `${Date.now()}`,
}, (error, result) => {
if (error) reject(error)
else resolve(result)
})
}) |
Hey all - checking in here. This issue seems to be third-party related which we do not support as previously mentioned by my colleague here: #4405 (comment) Please feel free to refer to the workarounds mentioned in the thread and we'll be closing this as not planned. |
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. |
Checkboxes for prior research
Describe the bug
Automatic credentials fromInstanceMetadata and fromContainerMetadata are not picked up and is hanging (no error message, no timeout) when used with Deno.
This happens on our CI in 2 different Jenkins instances (one EC2, one EKS), it does work locally with environment variables, or on the CI using NodeJS.
Note: I realize the Deno usage is not official, but any help would be greatly appreciated to either resolve the issue or debug it. Deno has been a tremendous improvement in our workflows.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Deno
Details of the browser/Node.js/ReactNative version
Reproduction Steps
Note that the following scripts are working correctly with this port, but this port has been abandoned: https://github.com/christophgysin/aws-sdk-js-v3 (https://deno.land/x/[email protected]/client-s3/mod.ts)
Test no credentials setup
main.ts
:deno run -A --reload main.ts
Output:
The script is running and hanging forever:
Test with credentials setup
main-container.ts
:deno run -A --reload main-container.ts
Output:
The script is running and hanging forever:
Test with credentials setup and
esm.sh
main-esmsh.ts
:deno run -A --reload main-esmsh.ts
Output:
The script output an error:
Observed Behavior
With a script executing a simple
ListObjectsCommand
on an S3 Bucket (scripts are provided in the reproduction step).npm:
specifier usage (deno npm specifier)Output:
Note that I had to use
@aws-sdk/credential-provider-imds
instead of@aws-sdk/credential-providers
, as withesm.sh
, thefromContainerMetadata
export is not available.Expected Behavior
To be logged in automatically.
Possible Solution
No response
Additional Information/Context
Deno version:
OS:
Mac OS 12.1, Linux alpine, Linux Centos
The text was updated successfully, but these errors were encountered: