Skip to content

Imported auth has incomplete username_attributes in frontend config file #13852

Open
@edwardfoyle

Description

@edwardfoyle

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

20

Amplify CLI Version

12.12.4

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

N/A

Describe the bug

When importing a Cognito User Pool that contains user attributes as email and phone number, the amplifyconfiguration.json file shows email only:

  "aws_cognito_username_attributes": [
    "EMAIL"
  ],

Expected behavior

Importing auth with email and phone username attributes should include both values in frontend config output.

Reproduction steps

Create Amplify-generated User Pool with user attributes.

amplify init
amplify add auth
a. Ensure that How do you want users to be able to sign in? Email or Phone Number is selected.
amplify push -y

Observe amplifyconfiguration.json as

{
  "aws_project_region": "us-east-1",
  "aws_cognito_region": "us-east-1",
  "aws_user_pools_id": "us-east-1_64iSuUnbm",
  "aws_user_pools_web_client_id": "7ec82dck4mlai0bf43c5dlvupt",
  "oauth": {},
  "aws_cognito_username_attributes": [
    "EMAIL",
    "PHONE_NUMBER"
  ],
  "aws_cognito_social_providers": [],
  "aws_cognito_signup_attributes": [
    "EMAIL"
  ],
  "aws_cognito_mfa_configuration": "OFF",
  "aws_cognito_mfa_types": [
    "SMS"
  ],
  "aws_cognito_password_protection_settings": {
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": []
  },
  "aws_cognito_verification_mechanisms": [
    "EMAIL"
  ]
}

Create another Amplify application with imported User Pool:

amplify init
amplify import auth
a. Use User Pool only (no identiity pool)
Select the Amplify-generated User Pool and client ID from the previous steps.
amplify push -y

Observe amplifyconfiguration.json file

{
  "aws_project_region": "us-east-1",
  "aws_cognito_region": "us-east-1",
  "aws_user_pools_id": "us-east-1_64iSuUnbm",
  "aws_user_pools_web_client_id": "7ec82dck4mlai0bf43c5dlvupt",
  "oauth": {},
  "aws_cognito_username_attributes": [
    "EMAIL"
  ],
  "aws_cognito_social_providers": [],
  "aws_cognito_signup_attributes": [
    "EMAIL"
  ],
  "aws_cognito_mfa_configuration": "OFF",
  "aws_cognito_mfa_types": [],
  "aws_cognito_password_protection_settings": {
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": []
  },
  "aws_cognito_verification_mechanisms": [
    "EMAIL"
  ]
}

Specifically noting that one has aws_cognito_username_attributes as EMAIL and the other has it set as EMAIL, PHONE_NUMBER

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues tied to the auth category of the CLIbugSomething isn't workingp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions