aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
81 stars 71 forks source link

Amplify CloudFormation deployment problem #2617

Open pr0g opened 2 weeks ago

pr0g commented 2 weeks ago

Amplify CLI Version

12.12.2

Question

I recently attempted to do a relatively large merge from our internal testing branch to our development branch, and then from our development branch to our release branch (each with their own Amplify backend and hosting environment).

test -> dev -> release

The merge from our test to development branch when running amplify push ran smoothly, however when merging the changes to our release branch, and pushing to our release Amplify environment, things failed.

The CloudFormation stack got into a bad state where one of the nested stacks was in UPDATE_ROLLBACK_FAILED. This was a nested stack that was part of the Amplify API functionality (so it contained resolvers, a DynamoDB table etc... - it was essentially a type in the GraphQL schema with @model added to it, and the change was to remove @model and return it to a POD type). This prevented being able to rollback the root stack. After speaking with Amplify AWS support, I was advised to delete the problematic stack (it is now in DELETE_COMPLETE), and after also speaking with CloudFormation AWS support, the stack was restored to a valid state (it could be rolled back, ignoring the problematic nested stack).

The problem I am facing now is attempting to do a new deployment is failing because the nested stack is reported as being in DELETE_COMPLETE.

Stack:arn:aws:cloudformation:eu-west-2:<account>:stack/amplify-<app>-release-94610-apirevuclient-<id>-AppUser-<id>/<id> is in DELETE_COMPLETE state and can not be updated.

I'd ideally like to have the parent stack of this nested stack completely forget about it. It doesn't need to be updated and can be removed, but I'm not sure how to do this. An alternative I thought of was recreating that nested stack, and somehow replacing it (slotting in the new one to replace the old one in the nested stack), but again I'm not sure if or how this is possible.

Running amplify push results in ["Index: 0 State: {\"deploy\":\"waitingForDeployment\"} Message: Resource is not in the state stackUpdateComplete"] and this is because of the issue mentioned above.

Could someone please advise how I can restore the CloudFormation stacks created by Amplify to get back to a working state? This is a release environment and I would really like to get it back to good working order so we can do another deployment.

Thank you very much for your help!

Tom

ykethan commented 2 weeks ago

Hey👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance.