Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
Amplify Console GitHub Issue Tracker
Describe the bug
Running amplify init fails with:
โฏ amplify init
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? Yes
? Choose the environment you would like to use: dev
Using default provider awscloudformation
โ ธ Initializing your environment: dev(node:98491) UnhandledPromiseRejectionWarning: NoSuchKey: The specified key does not exist.
at Request.extractError (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/services/s3.js:835:35)
at Request.callListeners (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/Users/jason/.nvm/versions/node/v14.1.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:98491) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:98491) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
โ ด Initializing your environment: dev
Amplify CLI Version
4.18.1
To Reproduce
amplify init in a way in which the cloudformation stack deploys successfully but then fails for some reason (perhaps a lack of S3 permissions, e.g. CreateBucket only).amplify init again.Expected behavior
amplify init should complete successfully (or fail with a meaningful error message).
Screenshots
Desktop (please complete the following information):
Additional context
This appears to be the same as https://github.com/aws-amplify/amplify-cli/issues/3595
I never had a backup.zip object, amplify init has never completed successfully.
There seem to be two issues here:
amplify delete).zip-utils doesn't seem to handle the inner promise correctly.I am a complete noob when it comes to JavaScript but I don't think the outer promise is necessary. Removing it seems to give more sane behaviour.
@steinybot From the transcript above it looks like you're checking out an existing environment. Amplify CLI requires the #current-cloud-backend.zip file to exists when checking out an existing environment, This file contains the state of the environment. Could you check to see if that file exists in the deployment bucket.
@yuth Yes it is an existing environment, one which failed to be created properly and is now stuck. I can't run init nor delete. As I mentioned, the backend.zip does not exist, it never did. There is an invalid assumption that an environment will always contain this backend.zip file.
FWIW, I'm having this same issue, and in my case I actually manually deleted the bucket. I realize I should not have, but the fact remains that my goal is to now start a "fresh" deployment with an amplify project out of source control and I feel like running amplify delete should provide SOME path of using my environment / setting it up new? perhaps something like a --force flag might be useful?
+1
+1000, this is blocking us from onboarding new developers .. no clue what the issue is
FWIW, I'm having this same issue, and in my case I actually manually deleted the bucket. I realize I should not have, but the fact remains that my goal is to now start a "fresh" deployment with an amplify project out of source control and I feel like running
amplify deleteshould provide SOME path of using my environment / setting it up new? perhaps something like a--forceflag might be useful?
We may not have all the information needed to tear down the env and I have added this in our backlog to investigate and and fix this.
In the mean time a workaround to fix this might be to update <project-root>/amplify/team-provider-info.json and remove the key with the env name. You will also have to go and delete the stack created for this env and delete the bucket itself using the console.
Fixed it by downgrading amplify cli to @aws-amplify/[email protected]
@pbirsinger could you share the stack trace/error that you get with latest version of the CLI, so I can narrow down the issue
i have the same issue anyone have the solution knowing that the dev and the zip exsist but faild to complet ??
Most helpful comment
Fixed it by downgrading amplify cli to
@aws-amplify/[email protected]