17

Summary: When attempting to amplify push changes to my graphql api via the Amplify CLI after aborting an amplify push (using ctrl-c) the cli complains that there is a deployment in progress and cannot deploy.

First error message:

A deployment is in progress.
If the prior rollback was aborted, run:
`amplify push --iterative-rollback` to rollback the prior deployment
`amplify push --force` to re-deploy

Both of those suggested commands result in:

✖ An error occurred when pushing the resources to the cloud

Cannot iteratively rollback as the following step does not contain a previousMetaKey: {"status":"WAITING_FOR_DEPLOYMENT"}
An error occurred during the push operation: Cannot iteratively rollback as the following step does not contain a previousMetaKey: {"status":"WAITING_FOR_DEPLOYMENT"}

All deployments in the Amplify Admin UI show as completed.

I tried amplify pull, amplify env pull, amplify pull --restore (all of which override your local changes - heads up). None worked to solve my problem. Still could not amplify push.

I finally found this idea: https://github.com/aws-amplify/amplify-adminui/issues/172#issuecomment-819784558

Solution

Deleting the deployment-state.json file as suggested in that reply allowed me to perform amplify push again. If you open it up you'll see that this is where the cli must be seeing the {"status":"WAITING_FOR_DEPLOYMENT"}

Sharing my solution here in case someone else has the same problem!

Kellen Busby
  • 531
  • 4
  • 10

3 Answers3

36

Solution

Deleting the deployment-state.json file as suggested in that reply allowed me to perform amplify push again. If you open it up you'll see that this is where the cli must be seeing the {"status":"WAITING_FOR_DEPLOYMENT"}.

Sharing my solution here in case someone else has the same problem!

ataravati
  • 8,891
  • 9
  • 57
  • 89
Kellen Busby
  • 531
  • 4
  • 10
  • 21
    For those who are wondering where deployment-state.json is, it is not in your local amplify directory. In order to find it, open amplify-meta.json and find your DeploymentBucketName. deployment-state.json should be in that bucket. – ninsonTan Jul 22 '21 at 00:17
  • 2
    Also worked for me, only my bucket name was in amplify/team-provider-info.json – d8k_irf Mar 17 '22 at 21:14
  • 3
    If like me don't have `deployment-state.json` in your `./amplify` folder, and there is nothing about it in `amplify-meta.json`, you have to go in `AWS S3` open your amplify bucket and you'll find there. https://github.com/aws-amplify/amplify-cli/issues/9665#issuecomment-1042723904 – NineCattoRules Aug 07 '22 at 08:31
  • Can't edit this thread(too many pending edits) but this is not a local file, but a file in your s3 bucket that should has a suffix of "deployment" – barshopen Jul 18 '23 at 09:27
7

Open the corresponding s3 bucket to the Amplify app.. usually begins with "Amplify-appname...." and delete the "deployment-state.json" file

saurav kumar
  • 71
  • 1
  • 2
0

Not sure if anything changed with debugging this error, but I experienced this today, and needed to go into the S3 bucket associated with my Amplify project and delete the deployment-state.json file, not than the amplify-meta.json file for this amplify cli error to go away and for amplify push to work correctly.

I noticed that the deployment-state.json file in the S3 bucket has a structure with the following values:

{
  "version": "1",
  "startedAt": "2023-06-20T00:00:00.000Z",
  "status": "DEPLOYING",
  "currentStepIndex": 0,
  "steps": [
    {
      "status": "WAITING_FOR_DEPLOYMENT"
    },
    {
      "status": "WAITING_FOR_DEPLOYMENT"
    },
    {
      "status": "WAITING_FOR_DEPLOYMENT"
    }
  ]
}

If you see these step values in a pending state like this, the amplify CLI will think a deployment is happening or in the midst of happening. Perhaps deleting this file is what prompts amplify to accept updates to your cloudformation stack.

InterstellarX
  • 712
  • 1
  • 8
  • 16