I'm signing up users to my application using serverless and AWS Lambda/Cognito, and I'd like to send a confirmation email after the users sign up. To do this, I created a postConfirmation function definition in my serverless.yml to be triggered after the postConfirmation Cognito event fires, but that function doesn't seem to get called at all. What could be the issue?
serverless.yml
...
postConfirmation:
description: Cognito handler for when a user is confirmed, here it is used for storing the data to database and sending a confirmation email
name: "${self:service}-users-post-confirmation-cognito-trigger-${self:provider.stage}"
handler: src/service/users/postConfirmationTrigger.handler
dependsOn:
- CognitoUserPoolMyUserPool
events:
- cognitoUserPool:
pool: ${self:service}-user-pool-${self:provider.stage}
trigger: PostConfirmation
existing: true
I'm trying to see if the postConfirmation handler is called at all:
exports.handler = (event, context, callback) => {
console.log(`this function fires!`)
console.log(event)
}
but I don't see anything in the logs. Not sure how to trigger the handler
