Deploy fails when adding Cognito requiredAttributes as per documentation
See original GitHub issueThe CDK documentation shows how to add required attributes to the Cognito user pool. However, when implemented as per the documentation, the deploy fails. Removing the the requiredAttributes
property results in a successful build.
Reproduction Steps
new cognito.UserPool(this, `${id}Pool`, {
requiredAttributes: {
email: true,
fullname: true,
},
selfSignUpEnabled: true,
signInAliases: {
email: true,
username: false,
},
userPoolName: `${id}UserPool`,
})
Error Log
LappuApeStack: creating CloudFormation changeset...
0/8 | 10:16:47 AM | UPDATE_IN_PROGRESS | AWS::Cognito::UserPool | LappuApeStackPool (LappuApeStackPool52D61340)
1/8 | 10:16:49 AM | UPDATE_FAILED | AWS::Cognito::UserPool | LappuApeStackPool (LappuApeStackPool52D61340) Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: 51786c92-4147-43e5-8bff-e1ed2717a3f9)
new UserPool (/Users/fisu/Projects/lappu-ape/node_modules/@aws-cdk/aws-cognito/lib/user-pool.ts:518:22)
\_ new LappuApeStack (/Users/fisu/Projects/lappu-ape/lib/lappu-ape-stack.ts:15:40)
\_ Object.<anonymous> (/Users/fisu/Projects/lappu-ape/bin/lappu-ape.ts:6:1)
\_ Module._compile (internal/modules/cjs/loader.js:955:30)
\_ Module.m._compile (/Users/fisu/Projects/lappu-ape/node_modules/ts-node/src/index.ts:837:23)
\_ Module._extensions..js (internal/modules/cjs/loader.js:991:10)
\_ Object.require.extensions.<computed> [as .ts] (/Users/fisu/Projects/lappu-ape/node_modules/ts-node/src/index.ts:840:12)
\_ Module.load (internal/modules/cjs/loader.js:811:32)
\_ Function.Module._load (internal/modules/cjs/loader.js:723:14)
\_ Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
\_ main (/Users/fisu/Projects/lappu-ape/node_modules/ts-node/src/bin.ts:226:14)
\_ Object.<anonymous> (/Users/fisu/Projects/lappu-ape/node_modules/ts-node/src/bin.ts:485:3)
\_ Module._compile (internal/modules/cjs/loader.js:955:30)
\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
\_ Module.load (internal/modules/cjs/loader.js:811:32)
\_ Function.Module._load (internal/modules/cjs/loader.js:723:14)
\_ Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
\_ /usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:268:14
1/8 | 10:16:49 AM | UPDATE_ROLLBACK_IN_P | AWS::CloudFormation::Stack | LappuApeStack The following resource(s) failed to update: [LappuApeStackPool52D61340].
Environment
- CLI Version: 1.31.0 (build 8f3ac79)
- Framework Version: 1.31.0
- OS: MacOS 10.15.4
- Language: Typescript
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Managing error responses - Amazon Cognito
Amazon Cognito supports customizing error responses returned by user pools. Custom error responses are available for user creation and authentication, ...
Read more >CognitoIdentityProvider — Boto3 Docs 1.26.36 documentation
To set any required attributes that Amazon Cognito returned as requiredAttributes in the AdminInitiateAuth response, add a userAttributes.attributename ...
Read more >amazon-cognito-identity-js - npm
Amazon Cognito Identity SDK for JavaScript. You can now use Amazon Cognito to easily add user sign-up and sign-in to your mobile and...
Read more >AWS COGNITO AUTHENTICATION FOR PHP APPLICATION
Step by step instructions to implement AWS Cognito authentication to a simple PHP application that displays user attributes and a logout ...
Read more >AWS Cognito Backup And Restore Solution With Python3 ...
Amazon Cognito allows you easily add user sign-up, sign-in, and access ... For more information please refer to the AWS documentation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The Cognito service limits that required attributes for a UserPool cannot be modified after it has been created. It turns out this is the error message they throw when this is performed.
I was able to create a new stack with a user pool with the configurations you have provided.
Why is that? My stack depends on lot of other stack as well, so if I destroy cognito stack I need to destroy all the stack which it depends on.