aws-amplify / aws-amplify/amplify-cli

`amplify env pull --envName <env-name>` does not work as expected, pulls current env

Open
#11,487 0 comments 0 reactions 0 assignees View on GitHub
bug multienv ops-multienv p2
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?

pnpm

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

18

### Amplify CLI Version

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

### Amplify Categories

Not applicable

### Amplify Commands

Not applicable

### Describe the bug

see title. When running `amplify env pull --envName `, the CLI will only pull the current environment. This command is recommended to users when they opt to NOT modify their project's backend on `amplify pull` as shown here https://github.com/aws-amplify/amplify-cli/issues/11066#issuecomment-1261047852

### Expected behavior

the command pulls the specified env

### Reproduction steps

1. `amplify init -y`
2. `amplify env pull --envName doesnotexist`
3. observe CLI fetched current `dev` environment

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Amplify CLI's `env pull` command and how it handles the `--envName` argument, then reproduce the behavior with a nonexistent or alternate environment as described. Done means the command targets the requested environment and does not silently pull the current one; add or update coverage for the argument handling if the existing command tests expose it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.