Skip to content
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

aws-cognito: Custom attributes cannot have the same name as standard attributes #31593

Open
1 task done
lucavb opened this issue Sep 30, 2024 · 2 comments
Open
1 task done
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. effort/medium Medium work item – several days of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@lucavb
Copy link

lucavb commented Sep 30, 2024

Describe the bug

It is currently not possible to correctly create a Cognito user pool with custom attributes that share the same name as one of the standard attributes. It does not result in an error from CloudFormation. However, the resulting user pool is missing the custom attributes when they already exist as standard attributes which leads to errors when trying to create an app client and giving it permissions to alter those missing custom attributes.

We already have an existing user pool where we were able to add custom attributes with the same name. However when trying to create a completely new user pool with our configuration this now fails.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The custom attribute despite having same name as the equivalent standard attribute is created.

Current Behavior

The custom attribute with the same name is silently dropped.

Reproduction Steps

export class CognitoTestStack extends Stack {
    constructor(scope: Construct, id: string, props: StackProps) {
        super(scope, id, props);

        new UserPool(this, 'UserPool', {
            userPoolName: 'sample-cdk-test',
            customAttributes: { address: new StringAttribute({ mutable: true }) },
        });
    }
}

And the resulting attributes are:

Screenshot 2024-09-30 at 11 22 01

note the missing custom:address attribute.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.158.0 (build 4b8714d)

Framework Version

No response

Node.js Version

v20.14.0

OS

macOS 14.7 (23H124)

Language

TypeScript

Language Version

TypeScript (5.6.2)

Other information

No response

@lucavb lucavb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 30, 2024
@github-actions github-actions bot added @aws-cdk/aws-cognito Related to Amazon Cognito potential-regression Marking this issue as a potential regression to be checked by team member labels Sep 30, 2024
@pahud
Copy link
Contributor

pahud commented Sep 30, 2024

I noticed you selected "Regression Issue", do you have a specific version number that was working but not anymore in current version?

We already have an existing user pool where we were able to add custom attributes with the same name. However when trying to create a completely new user pool with our configuration this now fails.

Did you mean you didn't change any code but when you use the latest CDK version it fails. Was it having any error message?

The custom attribute with the same name is silently dropped.
what make you think it is silently dropped? Can you share more details?

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 effort/medium Medium work item – several days of effort and removed potential-regression Marking this issue as a potential regression to be checked by team member needs-triage This issue or PR still needs to be triaged. labels Sep 30, 2024
@lucavb
Copy link
Author

lucavb commented Sep 30, 2024

I noticed you selected "Regression Issue", do you have a specific version number that was working but not anymore in current version?

Sort of. Like I mentioned we have an older user pool where CloudFormation was successfully able to add these custom attributes to the pool. So if you wanna know if it was possible to add them directly during creation then I cannot answer that. But I can tell you that it was possible with a prior version to add the properties and it worked. Adding this was done on the 5th of August with version 2.138.0.

what make you think it is silently dropped? Can you share more details?

Well, CloudFormation does not throw an error over anything and just marks the stack as "Create Completed". To me that is silently dropping my explicit request to create the custom attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. effort/medium Medium work item – several days of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants