question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnhandledPromiseRejectionWarning: NoSuchKey: The specified key does not exist.

See original GitHub issue

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

  1. Run 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).
  2. Fix the cause of the problem above.
  3. Run amplify init again.

Expected behavior

amplify init should complete successfully (or fail with a meaningful error message).

Screenshots

Desktop (please complete the following information):

  • OS: macOS
  • Node Version: 14.1.0

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pbirsingercommented, Oct 12, 2020

Fixed it by downgrading amplify cli to @aws-amplify/cli@4.21.4

2reactions
kevin-mitchellcommented, May 10, 2020

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon S3 exception: "The specified key does not exist"
Well this error is actually rather straight forward. it simply means that your file does not exist up within the S3 bucket.
Read more >
NoSuchKey: The specified key does not exist. #4232 - GitHub
js:116:18) (node:11249) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an ...
Read more >
NoSuchKey: The specified key does not exist. - YouTube
aws #sam #s3 #lambdamessage: 'The specified key does not exist.', code: ' NoSuchKey ', ERROR Invoke Error {"errorType":" NoSuchKey " ...
Read more >
Troubleshoot the 404 NoSuchKey error from Amazon S3
However, Amazon S3 is returning the 404 "NoSuchKey" error. ... Amplify Push Fail - Appsync API error - S3 The specified key does...
Read more >
GetObjectCommand | S3 Client - AWS SDK for JavaScript v3
To get an object from such a logical hierarchy, specify the full key name for the ... If the object you request does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found