aws-amplify / aws-amplify/amplify-cli
receiving `The specified key does not exist` after exiting `amplify env add` flow mid-init
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
pnpm
### If applicable, what version of Node.js are you using?
18
### Amplify CLI Version
11.1.1
### What operating system are you using?
mac
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
n/a
### Describe the bug
After exiting `amplify env add` shortly after it started deploying the root stack will produce an environment that you cannot `pull` or recreate, forcing you to manually delete the stack in the CloudFormation console.
When we do this, the stack still creates the deployment bucket but it will be empty, thus the reason why we run into this error.
### Expected behavior
Amplify CLI allows deleting the stack if the bucket is empty.
### Reproduction steps
1. `amplify init -y`
2. `amplify env add asdf`
3. wait for it to start deploying the root stack and ctrl+c
4. observe `amplify env add asdf` produces "Stack [amplify-1432-asdf-110206] already exists"
5. observe `amplify pull --envName asdf --appId ` produces "Error downloading #current-cloud-backend.zip from deployment bucket: amplify-1432-asdf-110206-deployment, the error is: The specified key does not exist."
### Project Identifier
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
### Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Research direction
Reproduce the failure with `amplify init -y`, `amplify env add asdf`, interruption during root-stack deployment, and `amplify pull --envName asdf --appId `. Trace the `amplify env add` and `amplify pull` entry points around the empty deployment bucket and stack cleanup; done means an interrupted initialization can be deleted or recreated without the missing-key error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100