Cognito phone number validation error

0

Enter image description here "I have 2 user pools:

User pool 1: ・Created by someone else via the AWS console.

User pool 2: ・I'm trying to view creating a clone of user pool 1 using CDK because I want to manage it with source code. When I check on the console, user pool 1 and 2 have the same information, both requiring phone number attribute. However, when I use the AWS SDK v2 to create a user, if I set the phone number to an empty string, I can successfully register on user pool 1, while user pool 2 encounters the following error: Attributes did not conform to the schema: 2 validation errors detected: Value at 'userAttributes.phoneNumbers.member.complexListValue.1.member.value.member.stringValue' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'userAttributes.phoneNumbers.member.complexListValue.1.member.value.member.stringValue' failed to satisfy constraint: Member must satisfy regular expression pattern: [\p{L}\p{M}\p{S}\p{N}\p{P}\t\n\r  ]+

My goal is to create a 100% clone of user pool 1 using CDK, but I don't understand why user pool 1 does not validate phone number length, as there is no setting for this. I have diffed the YAML but they only differ in identities (user pool 1 does not have, user pool 2 does have):

  • AttributeDataType: "String" DeveloperOnlyAttribute: false Mutable: true Name: "identities" Required: false StringAttributeConstraints: {}Enter image description here
1 Answer
0

Hello,

Thank you for reaching out.

I understood your concern that you are trying to create identical user pool as your old user pool using SDK, however you are encountering error when you are setting empty phone number in your new user pool. It does works fine in your old user pool and it allows to set empty phone number.

I would like to inform you that Cognito has stopped supporting empty string as an attribute value for new user pools and this is the reason even both user pool has identical configuration but you are not able to set empty string in Phone number attribute in your new user pool.

I hope this answers your question. please feel free to reach out to AWS Technical support team for any assistance.

Thank you!!

AWS
SUPPORT ENGINEER
answered 15 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions