Amplify-cli: UnhandledPromiseRejectionWarning: AccessDenied: Access Denied and hanging process in `amplify init`

Created on 3 Nov 2020  Â·  4Comments  Â·  Source: aws-amplify/amplify-cli

Describe the bug

When I run amplify init on a cloned project, I should not see ugly unhandled promise rejections. I would also expect the command to run to completion or error, not hang.

Amplify CLI Version
4.32

To Reproduce

  1. clone https://github.com/m-abdelwahab/trello-amplified
  2. run amplify init

Expected behavior

it should error cleanly when i dont own a project that i run amplify init on.

actual behavior

it prints out the ugly error stack and it hangs at amplify init

image

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
? Choose your default editor: Visual Studio Code
Using default provider  awscloudformation

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use default
â ¼ Initializing your environment: dev(node:15244) UnhandledPromiseRejectionWarning: AccessDenied: Access Denied
    at Request.extractError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/services/s3.js:700:35)
    at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
(node:15244) 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:15244) [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

Additional context

this is the exact same issue as https://github.com/aws-amplify/amplify-cli/issues/5665. what is the systematic solve for this rather than opening up issues one by one?

cc @m-abdelwahab purely for info

bug pending-release pending-response platform

Most helpful comment

@sw-yx This should be fixed in the next release. I will keep this open and confirm it once we have released

All 4 comments

@sw-yx This should be fixed in the next release. I will keep this open and confirm it once we have released

Hi @sw-yx

we have released the fix. Can you verify if it works?

this is what i get on 4.32.1:
image

is that the message you want to show when i'm cloning a project that is not mine? also it looks like a space is missing

for amplify env add

image

why does this command ask me if i want to use an existing environment when i obviously want to add a new environment?

Was this page helpful?
0 / 5 - 0 ratings