'During which actions is AWS Cognito Lambda `Pre-signup` invoked?

There is some ambiguity in the docs...

These docs seem to imply that pre-signup is called only during signup and first-time (?) external provider login. The only trigger source constants mentioned are:

  • PreSignUp_SignUp
  • PreSignUp_AdminCreateUser
  • PreSignUp_ExternalProvider

However, the ForgotPassword doc mentions calling it as well:

When you use the ForgotPassword API action, Amazon Cognito invokes any functions that are assigned to the following triggers: pre sign-up, custom message, and user migration.

In general is there a definitive, accurate source of what Cognito Lambdas are called for which user/api actions?



Solution 1:[1]

Below is AWS's response to my comment on their docs page. In short pre-sign-up is NOT run on ForgotPassword.

We recently received feedback from you about the following page in the Cognito documentation:

https://docs.aws.amazon.com/en_us/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html

Your comments were:

What I'm trying to do: ...

What to make better: Does InitiateAuth trigger pre-signup? Its a bit ambiguous in the ClientMetadata section. Really each of these docs should have a section on lambdas invoked or better, a chart of how and when (for instance, ForgetPW is a three part process - when are the various lambdas invoked??)

I'm sorry that you're having difficulty finding the information you need. The sources for Pre sign-up triggers are listed at link [1]. The function runs when you run the SignUp and AdminCreateUser APIs, as well as when you sign in for the first time using an external provider. The triggers that you can run on InitiateAuth are Pre Authentication, Post authentication, Define/Create/Verify custom auth, pre token generation, custom message, and migrate user.

Link [1] also describes the triggers associated with a ForgotPassword process. You can run post confirmation, pre token, migrate user, and custom message functions.

Thanks for taking the time to send us feedback! We appreciate all feedback, whether it's positive or it alerts us to a problem we need to address. Please don't hesitate to contact us with any other feedback you might have about our documentation.

[1] Customizing user pool workflows with Lambda triggers - User pool Lambda trigger sources - https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html#cognito-user-identity-pools-working-with-aws-lambda-trigger-sources

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hari Honor