aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
460 stars 116 forks source link

Amplify Publish Fails After Adding Environment #1463

Open pnewhook opened 3 years ago

pnewhook commented 3 years ago

Describe the bug I'm getting the following error when publishing a new environment for the first time. This may be related to https://github.com/aws-amplify/amplify-adminui/issues/32 as I experienced that error when creating my environment. Publish worked fine in the default environment that was created when I initialized the project.

> amplify env checkout mydev
> amplify publish
...
√ Zipping artifacts completed.
× Deployment failed! Please report an issue on the Amplify Console GitHub issue tracker at https://github.com/aws-amplify/amplify-console/issues.
An error occurred during the publish operation: User: arn:aws:sts::***********:assumed-role/us-east-1_*********_Full-access/amplifyadmin is not authorized to perform: amplify:ListJobs on resource: arn:aws:a
mplify:us-east-1:***********:apps/****************/branches/*********/jobs/*

To Reproduce Steps to reproduce the behavior:

  1. Enable Admin UI
  2. Create new amplify environment using amplify env add
  3. Try to publish this environment

Expected behavior Publish should work without error

Desktop (please complete the following information):

hsspain commented 3 years ago

@pnewhook Can you provide your app ID so that we can look at the logs for this and find a resolution? Thanks.

pnewhook commented 3 years ago

@hsspain d3osspxcmgm2mh

yibb-y commented 3 years ago

I had the problem that the amplify project was not completely configured. Try to run amplify configure project. For me the correct aws profile setting was missing. https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

pnewhook commented 3 years ago

@yibb-y That has no impact on my issue. The problem is it seems the deployment steps for personal environments are routed through the admin console, and that assumed role doesn't have the necessary permissions to deploy.

I'm giving up hope the Amplify team is going to correct these at the CLI/Console level, so I'm just creating a policy to get around this, here are the other errors I've run into

An error occurred during the publish operation: User: arn:aws:sts::****:assumed-role/us-east-1_NzTh2lOAs_Full-access/amplifyadmin is not authorized to perform: amplify:ListJobs on resource: arn:aws:a
mplify:us-east-1:*****:apps/*********/branches/devpeter/jobs/*

An error occurred during the publish operation: User: arn:aws:sts::****:assumed-role/us-east-1_NzTh2lOAs_Full-access/amplifyadmin is not authorized to perform: amplify:CreateDeployment on resource: a
rn:aws:amplify:us-east-1:*******:apps/******/branches/devpeter/deployments/*

An error occurred during the publish operation: User: arn:aws:sts::********:assumed-role/us-east-1_NzTh2lOAs_Full-access/amplifyadmin is not authorized to perform: amplify:StartDeployment on resource: ar
n:aws:amplify:us-east-1:*********:apps/**********/branches/devpeter/deployments/start
pnewhook commented 3 years ago

@hsspain Getting more errors now An error occurred during the publish operation: User: arn:aws:sts::*******:assumed-role/us-east-1_FkmpC79eZ_Full-access/amplifyadmin is not authorized to perform: amplify:StopJob on resource: arn:aws:amplify:us-east-1:******:apps/d9b4w606pj1v2/branches/test/jobs/12/stop

notpresleybutelvis commented 3 years ago

I think the error pops up because the role is an assumed role, it may have not been configured to do publish due to a bug. Here is a workaround for this Run amplify configure project select the first option ? Which setting do you want to configure? AWS Profile setting ? Do you want to set the project level configuration Yes ? Select the authentication method you want to use: AWS profile ? Please choose the profile you want to use