Nitesh
Nitesh

Reputation: 1637

Invalid AttributeDataType input, consider using the provided AttributeDataType enum

I am trying to create aws cognito user pool using aws cdk. below is my code -

user_pool = _cognito.UserPool(
    stack,
    id="user-pool-id",
    user_pool_name="temp-user-pool",
    self_sign_up_enabled=True,
    sign_in_aliases={
        "username": False,
        "email": True
    },
    required_attributes={
        "email": True
    }   
)

I want to set "Attributes" section in User pool for email . But above code gives me this exception -

Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID:

I have tried many scenarios but it didn't work. Am I missing something here. Any help would be appreciated. Thanks! I was referring this AWS doc to create userpool - https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cognito/UserPool.html and https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cognito/RequiredAttributes.html#aws_cdk.aws_cognito.RequiredAttributes

Upvotes: 10

Views: 4772

Answers (2)

Elroy Fernandes
Elroy Fernandes

Reputation: 1

https://github.com/terraform-providers/terraform-provider-aws/issues/3891

Found a way to get around it in production as well, where you don't need to recreate the user pool.

Upvotes: -1

rinde
rinde

Reputation: 1263

According to a comment on this GitHub issue this error is thrown when an attempt is made to modify required attributes for a UserPool. This leaves you two options:

  1. Update the code such that existing attributes are not modified.
  2. Remove the UserPool and create a new one. E.g. cdk destroy followed by cdk deploy will recreate your whole stack (this is probably not what you want if your stack is in production).

Upvotes: 16

Related Questions