Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app deploy fails with "lambda execution role already exists", while in reality it doesn't #13567

Closed
2 tasks done
alonsnir opened this issue Feb 1, 2024 · 9 comments
Closed
2 tasks done
Labels
functions Issues tied to the functions category pending-triage Issue is pending triage

Comments

@alonsnir
Copy link

alonsnir commented Feb 1, 2024

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v20.9.0

Amplify CLI Version

12.10.1

What operating system are you using?

Ubintu

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

🛑 The following resources failed to deploy:
Resource Name: LambdaExecutionRole (AWS::IAM::Role)
Event Type: create
Reason: aruggaLambdaRole5704a3e1-test already exists in stack arn:aws:cloudformation:eu-central-1:XXXXXXXXXX:stack/amplify-arugga-test-171255-functionpullRobotData-1SKXRCFA8NLLG/c8ebb100-80a6-11ee-8c1a-0655dace11f9


Resource Name: LambdaExecutionRole (AWS::IAM::Role)
Event Type: create
Reason: aruggaLambdaRolebc581e6a-test already exists in stack arn:aws:cloudformation:eu-central-1:XXXXXXXXXX:stack/amplify-arugga-test-171255-functionpushRobotData-2ETMI3BIHC18/c8ec2630-80a6-11ee-9d61-063ab5e351c9


🛑 Resource is not in the state stackUpdateComplete
Name: LambdaExecutionRole (AWS::IAM::Role), Event Type: create, Reason: aruggaLambdaRole5704a3e1-test already exists in stack arn:aws:cloudformation:eu-central-1:XXXXXXXXXX:stack/amplify-arugga-test-171255-functionpullRobotData-1SKXRCFA8NLLG/c8ebb100-80a6-11ee-8c1a-0655dace11f9, IsCustomResource: false

Name: LambdaExecutionRole (AWS::IAM::Role), Event Type: create, Reason: aruggaLambdaRolebc581e6a-test already exists in stack arn:aws:cloudformation:eu-central-1:XXXXXXXXXX:stack/amplify-arugga-test-171255-functionpushRobotData-2ETMI3BIHC18/c8ec2630-80a6-11ee-9d61-063ab5e351c9, IsCustomResource: false

already exists? let me check:

~$ aws iam list-roles --query 'Roles[?RoleName==`aruggaLambdaRole5704a3e1-test `].RoleName'
[]

an empty list returned.
Same if i search for that role in the Console - there is no such a role exists

Expected behavior

provide correct information

Reproduction steps

init an application, add lambda function, push

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@alonsnir alonsnir added the pending-triage Issue is pending triage label Feb 1, 2024
@josefaidt
Copy link
Contributor

Hey @alonsnir 👋 thanks for raising this! Does the output of the AWS CLI command change without the trailing space on the role name?

- aws iam list-roles --query 'Roles[?RoleName==`aruggaLambdaRole5704a3e1-test `].RoleName'
+ aws iam list-roles --query 'Roles[?RoleName==`aruggaLambdaRole5704a3e1-test`].RoleName'

As a few follow-up questions:

  • are you re-using the name of a previously-deployed Function?
  • did a previous deployment that attempted to create the same Function fail?

@josefaidt josefaidt added functions Issues tied to the functions category pending-response Issue is pending response from the issue author labels Feb 1, 2024
@alonsnir
Copy link
Author

alonsnir commented Feb 4, 2024

hey @josefaidt
removing trailing space makes no difference - same output, an empty list.

  • are you re-using the name of a previously-deployed Function?
    yes, the application, with its functions has been previously deployed in that same region and with the same backend environment name.

  • did a previous deployment that attempted to create the same Function fail?
    no, it has deployed it properly. Actually, I created another backend environment and it deployed successfully.

It looks like there are some leftovers after environment deletion which prevents re-deployment with the same name

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 4, 2024
@josefaidt
Copy link
Contributor

Hey @alonsnir can you try removing the orphaned role and re-attempt deployment?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Feb 6, 2024
@alonsnir
Copy link
Author

alonsnir commented Feb 7, 2024

Hi @josefaidt
I cannot, since it's not found anywhere, not in the console and not via the aws cli

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 7, 2024
@josefaidt
Copy link
Contributor

Hey @alonsnir ah yes, that's right. Would you mind sharing the project ID output from amplify diagnose --send-report? I want to take a look through the CFN templates and see if there are multiple resources.

Additionally, do you see multiple stack events for this execution role in the AWS CloudFormation console, or multiple references to these two roles? Lastly, can you try removing and re-adding the affected Functions?

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Feb 7, 2024
@alonsnir
Copy link
Author

alonsnir commented Feb 8, 2024

Hi @josefaidt
Project Identifier: 128eaa85e5463eec4ba5be02178d354f

What are slack events in this context? Where do I see them in the CF console?

I have removed and then re-added the functions but same result:

The following resources failed to deploy:
Resource Name: LambdaFunction (AWS::Lambda::Function)
Event Type: create
Reason: pullRobotData-test already exists in stack arn:aws:cloudformation:eu-central-1:xxxxxxxxxxxx:stack/amplify-arugga-test-171255-functionpullRobotData-1SKXRCFA8NLLG/c8ebb100-80a6-11ee-8c1a-0655dace11f9

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 8, 2024
@josefaidt
Copy link
Contributor

Hey @alonsnir there's an "Events" tab when you select a CloudFormation stack
image

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Feb 9, 2024
@alonsnir
Copy link
Author

@josefaidt so I have found the leftover resources and after manual deletion all back to normal.
Thanks

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 15, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issues tied to the functions category pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants