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

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

Open
singhjaskaran0501 opened this issue Nov 25, 2024 · 7 comments

Comments

@singhjaskaran0501
Copy link

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
Copy link
Contributor

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
Copy link
Author

singhjaskaran0501 commented Nov 25, 2024

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
Copy link
Author

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.

@ottokruse
Copy link
Contributor

I''m sorry mate that's too little information to help you. Perhaps you can share a HAR file so we can look at the AJAX requests that actually go to Cognito.

Also please share how you are invoking the library--give us something to work with please.

@singhjaskaran0501
Copy link
Author

singhjaskaran0501 commented Jan 10, 2025

Hi @ottokruse , sure let me add bit more explanation.

I am working on implementing a magic link functionality for user authentication using their email address. The process involves calling the requestSignInLink method, which successfully sends a magic link to the user's email as expected. However, an unexpected issue arises immediately after the magic link is sent.

Specifically, the "create-auth-challenge" Lambda function (refer to the uploaded image) is being invoked twice—once as intended and then again within just 3 seconds. This causes an error indicating that the system requires a minimum wait time of one minute between sending magic links.

From the application's perspective, which is built using SvelteKit, the requestSignInLink function is being called only once. I am unsure why the Lambda function is being triggered twice in such a short interval. What could be causing this issue?

@ottokruse
Copy link
Contributor

Can you share a HAR file too? How have you established that the frontend really only calls Cognito once? Review the network panel, are there 2 calls there? If yes the issue is on frontend side, if no the issue is on Cognito side.

How does the issue appear in the frontend? The user sees an error, or is it only logged in the browser console or so?

@singhjaskaran0501
Copy link
Author

singhjaskaran0501 commented Jan 13, 2025

Hi, I cannot share HAR file from browser, as we are working with sveltekit and requestSigninLink method is being called on server side. So Generating HAR file is not possible at the moment.

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