amplify-cli: Existing schema attributes cannot be modified or deleted after used amplify update auth

How did you install the Amplify CLI?

yarn

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

v12.20.0

Amplify CLI Version

12.0.0

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.

No manual changes made.

Describe the bug

I can’t push on AWS amplify because they need to update Auth because my version was too old. I did amplify upate auth and after i did amplify push and i have this error:

Existing schema attributes cannot be modified or deleted. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null)

Expected behavior

push my backend with amplify push.

Reproduction steps

Amplify update Auth Amplify push

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.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Hey @JackDurden00, from the provided custom attributes we will need to port them using the overrides functionality. Please refer to the construct and example as follows.

the user pool schema attributes: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-stringattributeconstraints

override.ts example:

  resources.userPool.schema = [
    ...(resources.userPool.schema as any[]), // Carry over existing attributes (example: email)
{
      attributeDataType: "String",
      mutable: true,
      name: "email",
      required: true,
 },    
{
      attributeDataType: "String",
      mutable: true,
      name: "code",
      required: false,
      stringAttributeConstraints: {
        maxLength: "256",
        minLength: "1",
      },
    },
...add remaining
  ];

Hey @JackDurden00, thank you for the information. yes we will need to add the remaining attributes as well. let me try and work on a reproduction and reach back here.