aws-samples / amazon-cognito-passwordless-auth

Passwordless authentication with Amazon Cognito: FIDO2 (WebAuthn, support for Passkeys), Magic Link, SMS OTP Step Up
Apache License 2.0
385 stars 70 forks source link

Duplicate Lambda Invocation Causing Magic Link Email Error: "Please wait for one minute before sending new link" #217

Open singhjaskaran0501 opened 1 day ago

singhjaskaran0501 commented 1 day ago

Hi.

I am experiencing an issue when sending a magic link to a user's email. While the magic link is generated, the process simultaneously throws an error with the message: "Please wait for one minute before sending new link."

Upon reviewing the logs, it appears that the Lambda function create-auth-challenge is being invoked twice.

Could you provide guidance or a resolution for this issue?

ottokruse commented 1 day ago

Sounds like you are actually invoking initiateAuth twice. Perhaps a React hook in strict mode. But that's guessing. Can you tell us how we can reproduce this?

singhjaskaran0501 commented 1 day ago

Application is implemented using SvelteKit rather than React. Upon reviewing the application logs, I confirmed that the requestSignInLink method is being invoked only once by the web application. Is there be anything internally that could be the cause of twice invoking of that lambda.

singhjaskaran0501 commented 23 hours ago

However, despite receiving the magic link, I am unable to log in with it. Upon reviewing the logs further, it appears that the verifyMagicLink method is not being triggered during the login attempt.

Could you provide guidance on what might be causing this issue? Are there specific configurations, middleware, or conditions that could prevent the verifyMagicLink method from being invoked? Any suggestions for further troubleshooting would be greatly appreciated.