- Newest
- Most votes
- Most comments
Hello,
I see you have a Lambda function invoking Cognito API's - adminCreateUser, adminAddUserToGroup, and adding the user info to a Dynamo DB table. You have noticed that sometimes the adminAddUserToGroup and adding user info to Dynamo DB fails but the user is still sent an invitation linked since you have hooked up a Pre Sign Up Lambda trigger with your User Pool.
First of all, please note that a Pre Sign Up Lambda Trigger gets invoked whenever any one of the below two API's are called:
- SignUp
- AdminCreateUser
So, pre sign up lambda trigger will get executed as soon the above API is invoked successfully.
Now, to answer your question, you can invoke a Lambda function from within a Lambda function. You may call the invoke API [1] from within the Lambda function to invoke your second Lambda function. Here is the boto3 reference:
response = client.invoke( FunctionName='string', InvocationType='Event'|'RequestResponse'|'DryRun', LogType='None'|'Tail', ClientContext='string', Payload=b'bytes'|file, Qualifier='string' )
For more information please check the below link: [+] https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
Alternatively, you may also try adding retries within your Lambda function to take care of the failed API calls (adminCreateUser, adminAddUserToGroup) so that you don't end up sending the invitation link to a user who doesn't meet your criteria.
Relevant content
- asked 2 years ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago