- 최신
- 최다 투표
- 가장 많은 댓글
Hello,
The error “there is already a construct with name” occurs when you have two constructs with the same construct Id in the same cdk project.
I’m assuming you have created a user pool earlier and now to configure it with SES, you have created one more construct with the same construct Id to define these
email: cognito.UserPoolEmail.withSES({
sesRegion: 'us-east-1',
fromEmail: 'noreply@myawesomeapp.com',
fromName: 'Awesome App',
replyTo: 'support@myawesomeapp.com',
**sesVerifiedDomain**: 'myawesomeapp.com',
}),
However, you can just add these properties to the user pool construct which already exists in your cdk code, as that would update that existing user pool with the above email configurations.
const userPool = new cognito.UserPool(this, 'userpool', {
userPoolName: 'my-user-pool',
selfSignUpEnabled: true,
signInAliases: {
email: true,
},
autoVerify: {
email: true,
},
standardAttributes: {
givenName: {
required: true,
mutable: true,
},
familyName: {
required: true,
mutable: true,
},
},
passwordPolicy: {
minLength: 6,
requireLowercase: true,
requireDigits: true,
requireUppercase: false,
requireSymbols: false,
},
accountRecovery: cognito.AccountRecovery.EMAIL_ONLY,
removalPolicy: cdk.RemovalPolicy.RETAIN,
email: cognito.UserPoolEmail.withSES({
sesRegion: 'us-east-1',
fromEmail: 'noreply@myawesomeapp.com',
fromName: 'Awesome App',
replyTo: 'support@myawesomeapp.com',
}),
});
If this is not the case, then do check for constructs with the same construct Id in your cdk project and rename any one of them.
Please note that, if the user pool was created through console then you would have to use CDK Custom Resources to add the email configurations and pass the parameters you wish to update to the “UpdateUserPool” API call handled by that custom resource. Kindly refer to the custom resource documentation [1] and API reference documentation [2] to know more about the same.
If the above suggestions don’t suffice your use case, please feel free to elaborate more on this issue.
[2] https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserPool.html
관련 콘텐츠
- AWS 공식업데이트됨 2년 전