Custom Message trigger is not working in cognito

Viewed 202

When I am trying to do a custom lambda trigger it's not working, but the Pre Authentication trigger works fine. Earlier it was working fine but suddenly it stopped working. I have also tried to create a new userpool in a different region, but the problem is there too. I have checked the permissions, the lambda has all the required permissions. Are these triggers stored somewhere or kept track of, so that once the trigger starts working the pending ones can be processed again?

Lambda code:

exports.handler = async (event, context, callback) => {
if(event.userPoolId === process.env.USER_POOL_ID) {
if(event.triggerSource === "CustomMessage_SignUp") {
    const { codeParameter } = event.request
    const { userName, region } = event
    const { clientId } = event.callerContext
    const { email } = event.request.userAttributes
    const url = 'some url'
    const link = `<a href="${url}?code=${codeParameter}&username=${userName}&clientId=${clientId}&region=${region}&email=${email}" target="_blank">here</a>`
    event.response.emailSubject = "Your verification link"; 
    event.response.emailMessage = `Thank you for signing up. Click ${link} to verify your email.`;
}
}
callback(null, event);
};
0 Answers
Related