Manually deleting an env
Which Category is your question related to? env
Amplify CLI Version 4.13.3
What AWS Services are you utilizing? api, auth, function
Is there a way to manually delete an amplify backend?
I've got a mangled environment that I've been trying to drop, however whenever I run it, it throws an error and keeps spinning (it spun overnight)
PS C:\Users\clay\Documents\Projects\oldmanhoops> amplify env remove dev
? Are you sure you want to continue? (This would delete all the environments of the project from the cloud and wipe out all the local amplify resource files) Yes
- Deleting resources from the cloud. This may take a few minutes...
Deleting env:dev
| Deleting resources from the cloud. This may take a few minutes...(node:4868) UnhandledPromiseRejectionWarning: NoSuchKey: The specified key does not exist.
at Request.extractError (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\services\s3.js:816:35)
at Request.callListeners (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\request.js:683:14)
at Request.transition (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\request.js:685:12)
at Request.callListeners (C:\Users\clay\AppData\Roaming\nvm\v12.2.0\node_modules\@aws-amplify\cli\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
(node:4868) 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(). (rejection id: 1)
(node:4868) [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.
I can delete the vast majority of individual resources and remove the entry for the env in team-provider-info.json, but I can't seem to get rid of the backend. The "delete" button in the amplify console just tells me to run the CLI command that fails.
If you have any recommendations, it would be appreciated!
@claym Did you manually delete the S3 deployment bucket?
No, i didn’t manually delete anything , except for a dynamo table, which may have started this whole nonsense
It’s deleted cloud formation stacks, cognito pools, and IAM roles though.
I’ve tried creating empty replacement of the stack and roles, but no dice.
I'm in a similar situation except (perhaps due to this fix) I get
multi-environment support is not available for Amplify projects with Mobile Hub migrated resources.
(this is when I try to run amplify env remove kaputenv)
Meanwhile, I am not using or referencing any Mobile Hub resources, migrated or otherwise. This will be the second time in less than two weeks that I will have had to rebuild my Amplify configuration and amazingly enough neither time was my fault (phew!). This stuff has to get more stable. It needs to move past errors or have an option to blow things away.
Well, this worked really well! AWS CLI v1.18 (not supported in 1.16 and not in 2.x)
aws amplify delete-backend-environment --app-id your-app-id-here --environment-name kaputenv
App ID is that alphanumeric string found in amplify/team-provider-info.json under { "any-environment": { "awscloudformation": { "AmplifyAppId".
AWS CLI to the rescue. Just make sure to find a version that supports it, like 1.18.
@rt-demetri does your project have any Mobile Hub created resources or did this message just show up out of the blue?
@rt-demetri does your project have any Mobile Hub created resources or did this message just show up out of the blue?
The project does not, to my knowledge (and I have created it twice), so this is out of the blue for us. I have Hosting (amplifyhosting), Auth (Cognito), Storage (DynamoDB), Function (a custom lambda behind API Gateway), and Api (REST, that calls the lambda). I wondered if the Amplify CLI was misperceiving one of these as Mobile Hub-related but this didn't happen prior to another person manually deleting a test environment in the console. I was previously able to enumerate the environments just fine. Now any environment-specific command returns the above error. So I fixed the hanging environment issue but the error persists.
Thanks for inquiring further!
@rt-demetri does your project have any Mobile Hub created resources or did this message just show up out of the blue?
Help is on the way! https://github.com/aws-amplify/amplify-cli/issues/5520
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.