aws-amplify / aws-amplify/amplify-cli

Pulling an env erases the previous one

Open
#11,372 6 comments 1 reaction 0 assignees View on GitHub
bug good first issue multienv ops-multienv p2 platform
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/dev/CONTRIBUTING.md#bug-reports).
- [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.

### How did you install the Amplify CLI?

npm

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

v12.22.12

### Amplify CLI Version

10.4.0

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

Nope.

### Amplify Categories

auth

### Amplify Commands

env

### Describe the bug

When I pull an environment with `amplify env pull --envName ...`, the previous environment that was pulled on my project is removed, and replaced by the env just pulled (as shown by `amplify env list` or `amplify/team-provider-info.json`).

### Expected behavior

All the envs pulled should be saved locally—an env pulled should not replace previous env pulled.

### Reproduction steps

1. Create an amplify project and select the default config
2. Create a new env (`amplify env add test`)
3. From a new folder, pull the amplify project (as a colleague would) `amplify pull --appId ...`
4. Select again the default config, expect for: `Do you plan on modifying this backend?`, respond `No`
5. List your current envs `amplify env list`. See that one env is listed (dev).
6. Run `amplify env pull --envName test`
7. Re-run `amplify env list`. See that only env is listed (test), and that _dev_ is no more listed.

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Project Identifier

Running `amplify diagnose --send-report` triggers a bug:

```
$ amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/
⠋ Creating Zip
File at path: '/Users/manu/sw-projects/lmad-locker/amplify/backend/backend-config.json' does not exist
✖ Creating Zip
```

### Log output

```
# Put your logs below this line

```

### Additional information

This bug is new to me since I upgraded to 10.4.0. Pulling new envs worked as expected previously.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `amplify pull`, `amplify env pull --envName test`, and `amplify env list`, then inspect how environment data is persisted in `amplify/team-provider-info.json`. Done means pulling `test` preserves `dev` in the local environment list and file, with existing environment behavior covered by tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.