Skip to content

How do I resolve the "Attributes did not conform to the schema" error in Amazon Cognito?

3 minute read
0

When I try to create or register a user for an existing user pool in Amazon Cognito, I receive an "Attributes did not conform to the schema" error.

Short description

When you create or register a user for an existing user pool in Amazon Cognito, you might get the following error message:

"Attributes did not conform to the schema"

This error occurs because you used empty values for required attributes, such as given_name or family_name. You must use non-empty values for required attributes in Amazon Cognito user pool schemas. 

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Use non-empty values for required attributes

You can use the following values as valid non-empty placeholders for required attributes:

  • "N/A"
  • "-"
  • "Unknown"

For example, the following admin-create-user AWS CLI command uses "N/A" as the value for given_name and family_name:

aws cognito-idp admin-create-user \
    --user-pool-id YOUR-USER-POOL-ID \
    --username YOUR-USERNAME \
    --user-attributes Name=given_name,Value="N/A" Name=family_name,Value="N/A" Name=email,Value="user@example.com"

Note: Replace YOUR-USER-POOL-ID with your user pool ID, YOUR-USERNAME with the username, and user@example.com with the user's email address.

Recreate the user pool without required attributes

After you create a user pool, you can't clear attributes that you set as required. If you don't need the required attributes for your application, then you must create a new user pool and not select required attributes.

To create a new user pool and migrate your users, complete the following steps:

  1. Open the Amazon Cognito console.
  2. Choose User pools, and then choose Create user pool.
  3. Under Required attributes for sign-up, don't select attributes.
  4. Configure the other application options, and then choose Create user directory.
  5. To migrate existing users, use a user migration AWS Lambda trigger.
  6. Update your application configuration to reference the new user pool ID and client ID.

Request a temporary account-level exception

If you can't recreate your user pool without required attributes, then contact AWS Support to request a temporary account-level exception. This exception allows Amazon Cognito to accept empty strings for required attributes across all user pools in your account.

Important: Don't use the exception as a long-term solution. Instead, recreate your user pool without required attributes, or use valid non-empty values for required attributes when you create users.

In your request for an exception, include the following information:

  • Your account ID
  • The affected AWS Region
  • The user pool ID
  • A description of your use case and why you require the temporary exception

Related information

Working with user attributes

Signing up and confirming user accounts

Creating user accounts as administrator

AWS OFFICIALUpdated a month ago