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

Signature Error with async init - SignatureDoesNotMatch #6163

Open
3 tasks done
VincentSurelle opened this issue Jun 5, 2024 · 3 comments
Open
3 tasks done

Signature Error with async init - SignatureDoesNotMatch #6163

VincentSurelle opened this issue Jun 5, 2024 · 3 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@VincentSurelle
Copy link

VincentSurelle commented Jun 5, 2024

Checkboxes for prior research

Describe the bug

Hello,

Following the issue #5192 and the workaround provided by @trivikr

If I take this case :

// ...
const client = new SSM();
const secret = client.getSecretValue(params); // Don't want to await there since it will extends my cold start time

const handler = async (event) => {
  // Do some stuff
  // More stuff that can take some time
  // Now I need it so I can await it
  doSomethingWithMySecret(await secret); // Perfect timing, there's more chances that my Promise is already resolved
}

Is this still possible with SDK v3 ?

Thanks :)

SDK version number

v3

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20

Reproduction Steps

const client = new SSM();
const secret = client.getSecretValue(params); // Don't want to await there since it will extends my cold start time

const handler = async (event) => {
  // Do some stuff
  // More stuff that can take some time
  // Now I need it so I can await it
  doSomethingWithMySecret(await secret); // Perfect timing, there's more chances that my Promise is already resolved
}

Observed Behavior

An SignatureDoesNotMatch Error is throwed sometimes (Auto Provisioning)

Expected Behavior

No error

Possible Solution

No response

Additional Information/Context

No response

@VincentSurelle VincentSurelle added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 5, 2024
@aBurmeseDev aBurmeseDev self-assigned this Jun 10, 2024
@aBurmeseDev aBurmeseDev added investigating Issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 10, 2024
@aBurmeseDev
Copy link
Member

Hi @VincentSurelle - thanks for reaching out.

I'm not sure what your workflow looks like but if you're not using TLA (Top Level Await) in your application, you can consider moving API call inside the handler, although not recommended. If you could share your workflow and repro code, I'd be happy to further look into it.

@aBurmeseDev aBurmeseDev added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. p2 This is a standard priority issue and removed investigating Issue is being investigated and/or work is in progress to resolve the issue. labels Jun 11, 2024
@VincentSurelle
Copy link
Author

Hello !

I don't think I can give more details with a repro than the code I show in the first message :

// ...
const client = new SSM();
// Here we are outside the handler -> During the cold start
// We start a promise -> Don't need to await it there since I won't need it now and don't want to extend cold start duration
// This way, promise is fired up, if cold start take, for example, 200ms after this line, that's 200ms earned on the request duration
const secret = client.getSecretValue(params);

const handler = async (event) => {
  // Here i do some unrelated stuff that can take some time or no. Just unrelated stuff
  doSomething();
  doSomethingElse():
  // Here, I need my secret.
  // Promise was started during cold start. Maybe 10ms before. Maybe 100 or event 1000ms or 10 minutes ? Whatever
  // But since I await my promise here. I have way more chances that it has been resolved.
  // That some precious ms
  doSomethingWithMySecret(await secret); // But if it's more than somes minutes after promise startup. The exception occurs
}

Now the problem appear with SDK V3

If it was a simple request like axios.get('https://amazon.com'). No trouble
SDK V2 was ok with this.

SDK V3 is not

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Jun 19, 2024
@VincentSurelle VincentSurelle changed the title SignatureDoesNotMatch Signature Error with async init - SignatureDoesNotMatch Jul 9, 2024
@VincentSurelle
Copy link
Author

Any update on this @aBurmeseDev ?

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. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants