Cognito User Pool not recognized in lambda trigger

0

After successfully creating an AWS cognito User Pool, I wanted to insert a lambda trigger for sign-up flow. Creating Lambda function from cognito

But the created lambda does not have a trigger Lambda with no trigger

Even if I want to create a manual trigger on the lambda It does not recognize the User Pool I Created Lambda trigger

If I create a lambda function first, however, I can see it from the cognito User Pool trigger menu. But after linking the lambda, it still has no trigger Enter image description here

I have looked at these common errors without luck There is no error pop-up or any other feedback I am in the same region in both the User Pool and Lambda. The lambda function has the right Resource-based policy statement Policy

How can I make it so that my lambda function trigger recognizes the Cognito User Pool?

1 Answer
1
Accepted Answer

Hi,

Cognito does not create the Lambda's Trigger.

You should check whether the Lambda's Permissions contain a Resource-based policy statements like this:

{
    "Version": "2012-10-17",
    "Id": "default",
    "Statement": [
        {
            "Sid": "lambda-allow-cognito",
            "Effect": "Allow",
            "Principal": {
                "Service": "cognito-idp.amazonaws.com"
            },
            "Action": "lambda:InvokeFunction",
            "Resource": "<your Lambda function ARN>",
            "Condition": {
                "StringEquals": {
                    "AWS:SourceAccount": "<your account number>"
                },
                "ArnLike": {
                    "AWS:SourceArn": "<your user pool ARN>"
                }
            }
        }
    ]
}
answered 7 months ago
  • Yes, it does have a Resource-based policy statement like the one you mentioned. (I edited the question to show it)

  • This resource-based policy means you're already successful. The Lambda in my own environment does not have a Trigger, but the Lambda runs fine.

  • You're right. It fires fine. It's just misleading that the trigger does not show up in the lambda function overview.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions