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

Cognito: Cannot create cfn user pool with only email MFA enabled #32615

Open
1 task
dpetzev opened this issue Dec 20, 2024 · 0 comments
Open
1 task

Cognito: Cannot create cfn user pool with only email MFA enabled #32615

dpetzev opened this issue Dec 20, 2024 · 0 comments
Assignees
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. needs-reproduction This issue needs reproduction. p2

Comments

@dpetzev
Copy link

dpetzev commented Dec 20, 2024

Describe the bug

Trying to create a Cognito user pool using the L1 construct and ONLY email MFA enabled leads to an error in CloudFormation.

This DOES work if I create the same user pool without any MFA enabled and then go to the AWS console and update it manually to have email only MFA.

Regression Issue

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

Last Known Working CDK Version

No response

Expected Behavior

CloudFormation is able to create the requested resource without issues.

Current Behavior

Error in CloudFormation with this message:

Resource handler returned message: "SMS configuration and Auto verification for phone_number are required when MFA is required/optional (Service: CognitoIdentityProvider, Status Code: 400, Request ID: ..., HandlerErrorCode: InvalidRequest)

Reproduction Steps

Here is an example of a stack that yields the error in CloudFormation

import * as cognito from 'aws-cdk-lib/aws-cognito';
import { App, Stack, StackProps } from 'aws-cdk-lib/core';

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

    const userPool = new cognito.CfnUserPool(this, 'UserPool', {
      userPoolName: 'UserPool123',
      adminCreateUserConfig: {
        allowAdminCreateUserOnly: true,
        unusedAccountValidityDays: 1,
      },
      usernameAttributes: ['email'],
      usernameConfiguration: {
        caseSensitive: false,
      },
      enabledMfas: ['EMAIL_OTP'],
      mfaConfiguration: 'OPTIONAL',
    });
  }
}

Possible Solution

No response

Additional Information/Context

Very similar bug, but with OTP only MFA enabled #11478

CDK CLI Version

2.173.2

Framework Version

No response

Node.js Version

v18.19.1

OS

Mac OS

Language

TypeScript

Language Version

No response

Other information

No response

@dpetzev dpetzev added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 20, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cognito Related to Amazon Cognito label Dec 20, 2024
@khushail khushail added needs-reproduction This issue needs reproduction. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 20, 2024
@khushail khushail self-assigned this Dec 20, 2024
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. needs-reproduction This issue needs reproduction. p2
Projects
None yet
Development

No branches or pull requests

2 participants