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

Error 'Existing schema attributes cannot be modified or deleted' in 'amplify push' following 'amplify update auth' #13160

Closed
1 task done
rayshi67 opened this issue Aug 23, 2023 · 12 comments
Labels
auth Issues tied to the auth category of the CLI migration-issue Issues tied to migration of the project between major CLI versions pending-triage Issue is pending triage

Comments

@rayshi67
Copy link

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

Authentication

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

I couldn't push with AWS amplify as the Auth version was too old that needs to be updated.
I did 'amplify update auth' and selected 'Apply default configuration without Social Provider (Federation)'.

However after i did 'amplify push' I got the following error:

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

Reproduction steps (if applicable)

amplify update Auth
amplify push

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line

Deployment failed.
Deploying root stack tamappdriverandroid [ =================----------------------- ] 3/7
	amplify-tamappdriverandroid-t… AWS::CloudFormation::Stack     UPDATE_ROLLBACK_COMPLETE       Wed Aug 23 2023 16:00:33…     
	functiontamdriverAmplifyAuthP… AWS::CloudFormation::Stack     UPDATE_COMPLETE                Wed Aug 23 2023 15:59:57…     
	storages3tamdrivers3firmwareb… AWS::CloudFormation::Stack     UPDATE_COMPLETE                Wed Aug 23 2023 15:59:47…     
	authtamdriverAmplifyAuth       AWS::CloudFormation::Stack     UPDATE_FAILED                  Wed Aug 23 2023 15:59:43…     
Deploying api amplifyDatasource [ ---------------------------------------- ] 0/26
Deploying auth userPoolGroups [ ---------------------------------------- ] 0/2
Deploying auth tamdriverAmplifyAuth [ ---------------------------------------- ] 0/7
	UserPoolClientRole             AWS::IAM::Role                 UPDATE_FAILED                  Wed Aug 23 2023 15:59:38…     
	UserPool                       AWS::Cognito::UserPool         UPDATE_FAILED                  Wed Aug 23 2023 15:59:38…     
Deployed function tamdriverAmplifyAuthPostConfirmation [ ======================================== ] 3/3
Deploying function tamdriverAmplifyTripReceiptEmail [ ---------------------------------------- ] 0/5
Deployed storage s3tamdrivers3firmwarebucket [ ======================================== ] 7/7

🛑 The following resources failed to deploy:
Resource Name: UserPool (AWS::Cognito::UserPool)
Event Type: update
Reason: Existing schema attributes cannot be modified or deleted. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null)
URL: https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/arn%3Aaws%3Acloudformation%3Aap-southeast-2%3A334851156215%3Astack%2Famplify-tamappdriverandroid-test-234322-authtamdriverAmplifyAuth-15Q51FO8UWH94%2F0f302b80-7f02-11ec-9b16-02a200717f74/events


🛑 Resource is not in the state stackUpdateComplete
Name: UserPool (AWS::Cognito::UserPool), Event Type: update, Reason: Existing schema attributes cannot be modified or deleted. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null), IsCustomResource: false


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

amplify --version
12.3.0

@ankpshah
Copy link

Amplify CLI might be right repo for this issue. Transferring this issue to Amplify CLI repo

@ankpshah ankpshah transferred this issue from aws-amplify/amplify-android Aug 28, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 28, 2023

Hey @ankpshah, thank you for reaching out. The issue appears to be similar to #13095 and #12827.

Was the Amplify CLI upgraded from version before 7.x? If yes, could you try adding the attributes using the override functionality by running amplify override auth. similar to #13095 and #12827.
Do let us know if this does not mitigate the issue.

@ykethan ykethan added auth Issues tied to the auth category of the CLI migration-issue Issues tied to migration of the project between major CLI versions pending-response Issue is pending response from the issue author pending-triage Issue is pending triage labels Aug 28, 2023
@rayshi67
Copy link
Author

rayshi67 commented Aug 28, 2023

Hi @ykethan

Thank you for the prompt reply. I managed to get it working by following #12827. And the command 'amplify push' has now got through.

However when I tried to clone the existing environment, it gives the following error,
image

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Aug 28, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 29, 2023

@rayshi67 could you check the environment stack in Cloudformation console for any error in the events?
Does this also occur when utilizing Amplify CLI, to add the env using amplify add env and amplify push?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Aug 29, 2023
@rayshi67
Copy link
Author

rayshi67 commented Aug 29, 2023

I deleted a couple of old environments yesterday before doing a clone, and I can see all deletes are completed successfully on Cloudformation console. I cannot see any relevant error there.

There was no error occurred using 'amplify add env' and 'amplify push' earlier. But we need the clone to work otherwise we would have to write migration scripts now

I tried again to clone the existing env today, and got back the same error,
'Cloning env:test to env: tamdev in app:d24pb2d1td9ltj failed'

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Aug 29, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 30, 2023

Hey @rayshi67, wanted to get some additional information in using the clone mechanism in the AWS console?
As using amplify add env and amplify push should create a new environment similar to your existing resources.
Additionally, could you also provide us additional information on the migration scripts and its usage?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Aug 30, 2023
@rayshi67
Copy link
Author

So what is the root cause of the error when doing the clone in Amplify console?

Without using the clone in Amplify console, how could we back up the Amplify environment including its data?

And if we use ‘amplify env add’ to spin a new env, how would the data in cognito, dynamodb, and s3 etc in existing amplify env get populated into the newly created env? At the moment we haven’t got any mechanism in place for achieving that. So it would be great if you could point us to the right direction.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Aug 30, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 31, 2023

@rayshi67 thank you for the information. The clone functionality in the AWS Amplify console is similar to amplify add env, it does not clone the data for the underlying resources being created. As you have pointed, we may have to utilize custom scripts or AWS services that may assist in cloning the data.
additionally, the clone error appears to be similar to aws-amplify/amplify-hosting#3022. I have reached out to our folks in hosting team and will provide an update as soon as I receive any additional information.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Aug 31, 2023
@ykethan
Copy link
Contributor

ykethan commented Sep 7, 2023

wanted to provide an update on this issue, I was able to reproduce the issue by diving into the logs. The clone error was occurring due to resource overrides being present in the project. I have reached out to the appropriate Amplify team regarding this behaviour.
But we should be able to utilize amplify add env to create a environment with similar resources as a workaround. Thank you for your patience.

@rayshi67
Copy link
Author

rayshi67 commented Sep 8, 2023

Thank you for the update.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Sep 8, 2023
@ykethan
Copy link
Contributor

ykethan commented Sep 11, 2023

Closing the issue, please feel free in reaching out to us again.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues tied to the auth category of the CLI migration-issue Issues tied to migration of the project between major CLI versions pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants