How do I check CloudWatch logs for errors when I import users into a user pool with an AWS Lambda trigger?
I want to check for errors that are reported when I import users into a user pool with a user migration AWS Lambda trigger.
"I want to check for errors that are reported when I import users into a user pool with a user migration AWS Lambda trigger.Short descriptionAmazon Cognito allows you to import users into an Amazon Cognito user pool with a user migration Lambda trigger. This import process receives metadata about users who try to sign in. Then, it returns user profile information from an external data source or another user pool.For information on common errors during the import process, see How do I troubleshoot common errors with importing process in Amazon Cognito?To check for common errors, do the following:Find the name of the Lambda trigger.Find the CloudWatch log group.Use CloudWatch log stream.ResolutionFind the name of the Lambda triggerUsing the older Amazon Cognito interfaceOpen the Amazon Cognito console.Choose Manage User Pools.Choose your user pool.In the navigation pane, choose Triggers under General settings.Find the User Migration section, and note the name of the Lambda function.Using the new Amazon Cognito interfaceOpen the Amazon Cognito console.Choose your user pool.Under the User pool properties tab, find the information for the Lambda triggers.Note the name of the Lambda function for Migrate user Lambda trigger found under the section Attached Lambda function.Using the Lambda consoleOpen the AWS Lambda console.Search for the Lambda trigger that you created for your import job.Lambda migration trigger name example:TestingMigrationFind the CloudWatch log groupOpen the CloudWatch console.Expand Logs in the navigation pane, and then select Log Groups.Use the Log Groups search bar functionality to look for the Lambda migration trigger name that you noted earlier.CloudWatch log group example:/aws/lambda/TestingMigrationOr, you can also use Lambda console directly to access the CloudWatch log groups.Using the Lambda consoleOpen the AWS Lambda console.Search for the Lambda trigger that you created for your import job.Under the Monitor tab, select View logs in CloudWatch.This automatically redirects you to the Amazon CloudWatch console for the Lambda trigger's CloudWatch logs.Find the CloudWatch log streamWhile still in CloudWatch, select the log group that you found for your user pool during the previous steps.Select the Log Streams tab, and find the log stream.Select the log stream to check the log events for the Lambda migration import error.CloudWatch log stream example:[Timestamp]    START RequestId: 801399c5-b60a-40b4-ae54-f7c51c29043c Version: $LATEST[Timestamp]    [ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': unexpected indent (lambda_function.py, line 31) Traceback (most recent call last):   File "/var.....[Timestamp]    END RequestId: 801399c5-b60a-40b4-ae54-f7c51c29043cNote: Based on this example, the error reported in CloudWatch log stream shows that there's an indentation issue in the code that's causing the Lambda trigger to fail.Related informationImporting users into user pools with a user migration Lambda triggerHow do I troubleshoot common errors with importing process in Amazon Cognito?Follow"