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

after removing an environment some resources not been deleted which prevent re-creation with the same name #13468

Closed
2 tasks done
alonsnir opened this issue Dec 10, 2023 · 4 comments
Labels
multienv Issues tied to multiple environment feature in the CLI pending-triage Issue is pending triage

Comments

@alonsnir
Copy link

How did you install the Amplify CLI?

npm

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

v16.16.0

Amplify CLI Version

12.7.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.

none

Describe the bug

Deploying root stack arugga [ =======--------------------------------- ] 2/12
amplify-arugga-costa-182547 AWS::CloudFormation::Stack UPDATE_ROLLBACK_COMPLETE Sun Dec 10 2023 18:34:11…
Deployment failed.
Deploying root stack arugga [ =======--------------------------------- ] 2/12
amplify-arugga-costa-182547 AWS::CloudFormation::Stack UPDATE_ROLLBACK_COMPLETE Sun Dec 10 2023 18:34:11…
functionSQSToIoT AWS::CloudFormation::Stack CREATE_FAILED Sun Dec 10 2023 18:32:41…
functionsunset AWS::CloudFormation::Stack CREATE_FAILED Sun Dec 10 2023 18:32:41…
functionhobo AWS::CloudFormation::Stack CREATE_FAILED Sun Dec 10 2023 18:32:41…
functionIotToSQS AWS::CloudFormation::Stack CREATE_FAILED Sun Dec 10 2023 18:32:41…
hostingamplifyhosting AWS::CloudFormation::Stack DELETE_COMPLETE Sun Dec 10 2023 18:33:20…
Deploying api arugga [ ---------------------------------------- ] 0/10
Deploying auth aruggaauth [ ---------------------------------------- ] 0/7
Deploying auth userPoolGroups [ ---------------------------------------- ] 0/4
Deploying custom customResources [ ---------------------------------------- ] 0/12
Deployed function IotToSQS [ ======================================== ] 3/3
Deployed function SQSToIoT [ ======================================== ] 3/3
Deployed function hobo [ ======================================== ] 4/4
AmplifyFunctionSecretsPolicy AWS::IAM::Policy DELETE_COMPLETE Sun Dec 10 2023 18:33:39…
Deploying function pullRobotData [ ---------------------------------------- ] 0/4
Deploying function pushRobotData [ ---------------------------------------- ] 0/4
Deploying function sunset [ =============--------------------------- ] 1/3
LambdaExecutionRole AWS::IAM::Role CREATE_FAILED Sun Dec 10 2023 18:32:33…
LambdaFunction AWS::Lambda::Function DELETE_COMPLETE Sun Dec 10 2023 18:33:45…
lambdaexecutionpolicy AWS::IAM::Policy CREATE_FAILED Sun Dec 10 2023 18:33:10…
Deployed hosting amplifyhosting [ ======================================== ] 1/1
AmplifyBranch AWS::Amplify::Branch DELETE_COMPLETE Sun Dec 10 2023 18:33:13…

🛑 The following resources failed to deploy:
Resource Name: LambdaExecutionRole (AWS::IAM::Role)
Event Type: create
Reason: aruggaLambdaRolec936b18e-costa already exists in stack arn:aws:cloudformation:ap-southeast-2:************:stack/amplify-arugga-costa-91422-functionIotToSQS-1V3P3H2FEZLO1/986cd5a0-54fa-11ed-9d69-02ef1775d74e

Resource Name: LambdaExecutionRole (AWS::IAM::Role)
Event Type: create
Reason: aruggaLambdaRoled21dd9c4-costa already exists in stack arn:aws:cloudformation:ap-southeast-2:************:stack/amplify-arugga-costa-91422-functionSQSToIoT-1V0DGBM8880XS/986e8350-54fa-11ed-ab15-02ed8050d534

🛑 Resource is not in the state stackUpdateComplete
Name: LambdaExecutionRole (AWS::IAM::Role), Event Type: create, Reason: aruggaLambdaRolec936b18e-costa already exists in stack arn:aws:cloudformation:ap-southeast-2:************:stack/amplify-arugga-costa-91422-functionIotToSQS-1V3P3H2FEZLO1/986cd5a0-54fa-11ed-9d69-02ef1775d74e, IsCustomResource: false

Name: LambdaExecutionRole (AWS::IAM::Role), Event Type: create, Reason: aruggaLambdaRoled21dd9c4-costa already exists in stack arn:aws:cloudformation:ap-southeast-2:************:stack/amplify-arugga-costa-91422-functionSQSToIoT-1V0DGBM8880XS/986e8350-54fa-11ed-ab15-02ed8050d534, IsCustomResource: false

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: b8985c2d-0b49-45d6-acde-0275eccbaf1a

Expected behavior

amplify env remove env
should remove any resource created

Reproduction steps

amplify env add costa
amplify push -y
amplify env remove costa
amplify env add costa
amplify push -y

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 Dec 10, 2023
@ykethan
Copy link
Member

ykethan commented Dec 12, 2023

Hey @alonsnir, thank you for reaching out. Wanted to get some additional information on the behaviour.
Does this error message occur when creating a new environment name?
Tried reproducing the issue with the following steps but did not experience an error message

  1. amplify init
  2. amplify add function
  3. amplify push
  4. amplify add env test
  5. amplify push
  6. amplify env checkout dev
  7. amplify remove env
  8. amplify add env test
  9. amplify push

from the error message the LambdaExecutionRole already exists. Could you provide some information on the function setup such as permissions or resource dependancy on other categories, would assist us in reproducing the behaviour.

@ykethan ykethan added multienv Issues tied to multiple environment feature in the CLI pending-response Issue is pending response from the issue author labels Dec 12, 2023
@PeteDuncanson
Copy link

If it helps we've seen this too for age (our project is 3+ years old on Amplify) but haven't created a new environment for a long while so not sure if its still doing it.

Limits we saw included if you created an environment and then later deleted it you couldn't create one with the same name and we have no idea why. So "dev" once used and deleted couldn't be used again later for a new environment for instance. This is especially annoying when in the early days we would try debugging an Amplify feature with the Amplify team and have to create different environments each time.

Additionally I still find old environment artifacts in CloudWatch, Lambda, etc. which you can find by searching for via . so ".dev" in the search box on the service in question. Worth while checking and deleting anything you find (be careful though and double check before deletes!). I think we've cleaned up most of our old stuff these days, once its gone its gone but Amplify should ideally clean this stuff up at the point of removal but again this might be old knowledge/bug now but thought it worth mentioning given the original comments.

@alonsnir
Copy link
Author

alonsnir commented Feb 6, 2024

@ykethan thanks for getting back. I think the error is due to the messed up team-provider-info.json, as I just have noticed the error message refers wrong (not the one I intended) region. Closing this. Thank you

@alonsnir alonsnir closed this as completed Feb 6, 2024
@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

⚠️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
multienv Issues tied to multiple environment feature in the CLI pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants