4
votes

Working on a web app using react.js that I picked up from another developer. Currently, trying to use AWS Amplify and I will eventually use AWS Cognito for authentication purposes.

I am using the following tutorial: https://hackernoon.com/react-authentication-in-depth-4deebda9aa45

I've already executed the following commands:

$ npm i -g @aws-amplify/cli

$ amplify configure

I've set up my CLI with the amplify config command, to include setting up the environment, access key ID and Secret Access key.

Error comes after running

$ amplify init

I've already seen a stack overflow post that states that this is a known error for the CLI, and that a fix has been implemented in the latest version of the CLI. I've tried updating amplify and re-installing. This is my second attempt to reinstall.

Here is a copy of the error in terminal.

MacBook-Air% 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: discrete
Using default provider  awscloudformation
✖ There was an error initializing your environment.
init failed
{ AccessDenied: Access Denied
    at Request.extractError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/services/s3.js:585: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:683: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:685:12)
    at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
  message: 'Access Denied',
  code: 'AccessDenied',
  region: null,
  time: 2019-05-01T18:09:17.901Z,
  requestId: '7814262360A7DF07',
  extendedRequestId:
   'Y1woT4qs3VOtSCQG7sWNu7zexB2O+ZNP3oiBugTdfkHbK4Um5vzOS05P5qsZRcRFUPVTAbey8Q0=',
  cfId: undefined,
  statusCode: 403,
  retryable: false,
  retryDelay: 155.200421877319 }

Expect environment to properly initialize and amplify to be properly configured.

1
I had this problem just now, and it was because I was trying to create a new environment with the same name as an existing environment. Choosing a new name fixed the issue. Letting you know on the small chance that this is the issue for you as well.jcharch
changing the name of the environment worked! Unfortuntely, the app itself has some other problems that I need to fix! If its not one thing its the other.Iwori15-5

1 Answers

0
votes

You can check those issues reported at github project.

We had a similar issue using '@aws-amplify/cli' is version: '2.0.0', at aws Amplify Console.

Our envs develop, PR, etc. were building fine but master did not.

So, we change the version from 2.0.0 to 4.0.0 and build start working again.

Check

Console broken again (probably related to aws-amplify/cli 2.0.0)

AccessDenied error when deploying backend