I'm setting up aws-amplify to my project. I am facing a problem in amplify push when I configured for the first time it worked fine. now i changed the repository since i had to do sub-tree from the old repo. Now when i do amplify push i get
Resource is not in the state stackUpdateComplete
⠸ Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack ⠸ Updating resources in the cloud. This may take a few minutes...
Following resources failed
✖ An error occurred when pushing the resources to the cloud
Resource is not in the state stackUpdateComplete An error occured during the push operation: Resource is not in the state stackUpdateComplete
14 Answers
Just to give some background about this error - what does Resource is not in the state stackUpdateComplete actually mean?
Well basically Amplify is telling you that one of the stacks in your app did not deploy correctly, but it doesn't know why (which is remarkably unhelpful, but in fairness it's deploying a lot of potentially complex resources).
This can make diagnosing and fixing the issue really problematic, so I've compiled this kind of mental checklist that I go through to fix it. Each of the techniques will work some of the time, but I don't think there are any that will work all of the time. This list is not intended to help you diagnose what causes this issue, it's literally just designed to get you back up and running.
The fast options (will solve most problems)
- Check the AWS Console! Sometimes the amplify-cli will show an error, but it actually did what you asked it to in the cloud. Before proceeding, always check to make sure the error was actually fatal.
- If you're sure your deployment is definitely failing, then next step is to MAKE A BACKUP OF YOUR LOCAL WORK before proceeding with any of the following steps.
- Firstly, you can try to restore your env from the one in the last working deployment in the cloud by running
amplify env pull --restore. - Try running
amplify push --iterative-rollback. It's supposed to roll your environment back to the last successful deployment, but tbh it rarely works. - Try running
amplify push --force. Although counter-intuitive, this is actually a rollback method. It basically does what you think--iterative-rollbackwill do, but works more frequently. - In the AWS console, go to the deployment bucket for your environment (the bucket will be named
amplify-${project_name}-${environment_name}-${some_random_numbers}-deployment). If there is a file calleddeployment-state.json, delete it and tryamplify pushagain from the CLI. - If you are working in a team of more than one developer, or have your environment in several different repos locally, or across multiple different machines, your
amplify/team-provider-info.jsonfile might be out of sync. Usually this is caused by the environment variable(s) in an Amplify Lambda function being set in one of the files but not in another. The resolution will depend on how out of sync these files are, but you can normally just copy the contents of the last workingteam-provider-info.jsonfile across to the other repo (from where the deployment is failing) and run the deployment again. However, if you've got multiple devs/machines/repos, you might be better off diffing the files and checking where the differences are. - If any of these worked, you can then re-add the any changes that were lost by diffing your repo again the backup you made and copying the changes back over.