-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Cognito: Custom Invite Message Template omits EmailMessage in sythed template #30315
Comments
Looks to be same problem with VerificationMessageTemplateProperty > EmailVerificationMessage as well. Subject works as expected, message body is dropped from the output template. |
@dreams-and-thoughts Good morning. Upon investigation, looks like you are using incorrect
So when we use the below stack with expected properties per documentation, the import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as cognito from 'aws-cdk-lib/aws-cognito';
export class Issue30315CognitoStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const userPool = new cognito.UserPool(this, 'user-pool', {
userPoolName: 'userpool',
selfSignUpEnabled: false,
enableSmsRole: false,
accountRecovery: cognito.AccountRecovery.EMAIL_ONLY,
customAttributes: {
roles: new cognito.StringAttribute({
minLen: 0,
maxLen: 2048
})
},
userInvitation: {
emailBody: "Test user invitation email body.",
emailSubject: "Test user invitation email subject.",
smsMessage: "Test user invitation SMS message."
}
});
}
} Output CFN template: Resources:
userpool38E431F2:
Type: AWS::Cognito::UserPool
Properties:
AccountRecoverySetting:
RecoveryMechanisms:
- Name: verified_email
Priority: 1
AdminCreateUserConfig:
AllowAdminCreateUserOnly: true
InviteMessageTemplate:
EmailMessage: Test user invitation email body.
EmailSubject: Test user invitation email subject.
SMSMessage: Test user invitation SMS message.
EmailVerificationMessage: The verification code to your new account is {####}
EmailVerificationSubject: Verify your new account
Schema:
- AttributeDataType: String
Name: roles
StringAttributeConstraints:
MaxLength: "2048"
MinLength: "0"
SmsVerificationMessage: The verification code to your new account is {####}
UserPoolName: userpool
VerificationMessageTemplate:
DefaultEmailOption: CONFIRM_WITH_CODE
EmailMessage: The verification code to your new account is {####}
EmailSubject: Verify your new account
SmsMessage: The verification code to your new account is {####}
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: Issue30315CognitoStack/user-pool/Resource
...
... Thanks, |
Hi, You should not assign If you use VSCode you can trigger parameter hints like this and you should see the And per @ashishdhingra mentioned in the source code, it maps to |
Great, got it. Thanks very much. Always been a bit confused by the CDK interface/types vs the L1 Cloudformation structures. |
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
When creating a custom Invite Message template:
The template output result is missing the EmailMessage property:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html#cfn-cognito-userpool-invitemessagetemplate-emailmessage
Expected Behavior
The final stack output template should contain the customized EmailMessage property.
Current Behavior
The output template does not contain the custom EmailMessage property.
Cognito console Messaging section is updated with the new custom SMS and Email subject, but the invite email body remains unchanged from the default.
Reproduction Steps
Create a stack with the following:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.141.0 (build 3d1c06e)
Framework Version
No response
Node.js Version
v18.14.1
OS
mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: