aws-amplify / aws-amplify/amplify-cli

I did amplify pull, but can't change environment

Open
#7,973 14 comments 3 reactions 0 assignees View on GitHub
feature-request multienv p3 platform-pull
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/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### How did you install the Amplify CLI?

yarn

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

v14.15.3

### Amplify CLI Version

5.3.0

### What operating system are you using?

Mac

### Amplify Categories

auth, storage, function, api

### Amplify Commands

pull

### Describe the bug

Our repository includes only `aws-exports.js` and does not have backend configuration( backend configuration is managed in another repository).

With the current latest CLI, I did `amplify pull` to change environment( we have two environments, production and staging) and got the message below.

```
% amplify pull
Amplify AppID found: xxx. Amplify App name is: our-app
Backend environment production found in Amplify Console app: our-app

Added backend environment config object to your project.
Run 'amplify pull' to sync future upstream changes.
```

No options to select env are shown. So I was not able to change it.

With previous version of CLI, I can change env like this.

```
% amplify pull
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use profile
? Which app are you working on? xxx
? Pick a backend environment: staging
? Choose your default editor: Visual Studio Code
? Choose the type of app that you're building javascript
Please tell us about your project
? What javascript framework are you using react-native
? Source Directory Path: src
? Distribution Directory Path: /
? Build Command: yarn build
? Start Command: yarn start
? Do you plan on modifying this backend? No

Added backend environment config object to your project.
Run 'amplify pull' to sync future upstream changes.
```

I checked that with cli@5.1.2 I changed env successfully but 5.3.0 or 5.2.1 I did not.

### Expected behavior

Backend environment can be changed.

### Reproduction steps

1. amplify pull

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.