-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
user pool - link style email verification fails to deploy #6811
Comments
If this is purely a feature request, are you able to explain what the correct parameters are for a 'link' styled template? As best I could find on any of the AWS documentation for this feature, CloudFormation for it, etc, what I was using was correct, which makes me think this is a bug? (though i'm not actually sure what the underlying calls being made are/how to debug them to get better details) |
@0xdevalias - Unfortunately, we plumb these messages straight down to Cognito and its the Cognito service that is generating this error, so it's currently not something the CDK controls or has information on. My best guess, looking at this documentation, is that You might have to contact support to get this information from the Cognito service. |
@0xdevalias - Try putting |
That makes sense. I did try that |
Ok, so I set the 'LINK' type via the AWS Console UI, then read back the value using the CLI: This is the relevant looking parts of the response: {
"SmsVerificationMessage": "Hello {username}, welcome to REDACTED! Use the following code to verify your account: {####}",
"EmailVerificationMessage": "Hello {username},\n\nWelcome to REDACTED!\n\nUse the following code to verify your account: {####}",
"EmailVerificationSubject": "Confirm your account on REDACTED",
"VerificationMessageTemplate": {
"SmsMessage": "Hello {username}, welcome to REDACTED! Use the following code to verify your account: {####}",
"EmailMessage": "Hello {username},\n\nWelcome to REDACTED!\n\nUse the following code to verify your account: {####}",
"EmailSubject": "Confirm your account on REDACTED",
"EmailMessageByLink": "Hello {username},\n\nWelcome to REDACTED!\n\nPlease click the link below to verify your email account. {##Verify Email##} ",
"EmailSubjectByLink": "Confirm your account on REDACTED",
"DefaultEmailOption": "CONFIRM_WITH_LINK"
},
"AdminCreateUserConfig": {
"AllowAdminCreateUserOnly": true,
"UnusedAccountValidityDays": 5,
"InviteMessageTemplate": {
"SMSMessage": "Hello {username}, you have been invited to join REMDR! Your temporary password is: {####}",
"EmailMessage": "Hello {username},\n\nYou have been invited to join REMDR!\n\nYour temporary password is: {####}",
"EmailSubject": "Invitation to join REMDR"
}
}
} So it would seem what we want to do this is
Sp my current workaround code looks like this: const cfnUserPool = userPool.node.defaultChild
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-verificationmessagetemplate.html
cfnUserPool.verificationMessageTemplate = {
defaultEmailOption: 'CONFIRM_WITH_LINK',
emailSubject: 'Confirm your account on REDACTED',
emailSubjectByLink: 'Confirm your account on REDACTED',
emailMessage: 'Hello {username},\n\nWelcome to REDACTED!\n\nPlease use the following code to verify your account: {####}',
emailMessageByLink: 'Hello {username},\n\nWelcome to REDACTED!\n\nPlease use the following link to verify your account: {##Verify Email##}',
} Which deployed successfully! |
@0xdevalias - it seems to me that the correct thing to do here is to not set the This would look like - const cfnuserpool = userpool.node.defaultChild as CfnUserPool;
cfnuserpool.emailVerificationMessage = undefined;
cfnuserpool.emailVerificationSubject = undefined; Can you check if this works for you, and sets up the user pool as you would expect? |
A couple of things happen with this change - - `emailVerificationMessage`, `emailVerificationSubject` and `smsVerificationMessage` properties are not set when link-style verification is used. This is root cause for the error message reported by the user. - The defaults `emailBody` and `emailSubject` are modified when link-style verification is used. They will now correctly contian the template placeholder '{##Verify Email##}'. fixes #6811
…oy (#6938) A couple of changes - - `emailVerificationMessage` and `emailVerificationSubject` properties are not set when link-style verification is used. This is root cause for the error message reported by the user. - The defaults `emailBody` and `emailSubject` are modified when link-style verification is used. They will now correctly contain the template placeholder `{##Verify Email##}`. - Validations are now added that email and SMS verification messages have the mandatory placeholders. fixes #6811
Reported by @0xdevalias -
generates the following error -
The text was updated successfully, but these errors were encountered: