amplify-cli: Environment name is invalid

How did you install the Amplify CLI?

Windows Installer, then amplify upgrade

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

18LTS

Amplify CLI Version

12.1.1

What operating system are you using?

Windows

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

I have tried to create new backend environment called ‘dev’.

Describe the bug

After creating new backend environment called ‘dev’ I tried to push everything. It failed multiple times. I tried to push individual backend features one by one, also without success. After some time I decided to delete it. It has been deleted (I suppose) on the backend. In fact I don’t see anything in Amplify Studio for example. But when issuing amplify env list, it is still there.

$ amplify env list

| Environments |
| ------------ |
| *staging     |
| prod         |
| dev          |

So I try to switch to it or remove again but it says Environment name is invalid

$ amplify env checkout dev
🛑 Environment name is invalid.

Resolution: Run amplify env list to get a list of valid environments.
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

$ amplify env remove dev
🛑 Environment name is invalid.

I’ve tried to see if there is anything in my “backend” folder, but there is nothing. For example, in team-provider-info.json there are only 2 environments listed: “prod” and “staging” and no “dev”.

At this point I don’t know how to get rid of it or how to switch into dev, because I actually still need it to be created.

Expected behavior

Remove env should work or there should be a way to remove it from list and create new with the same name.

Reproduction steps

$ amplify env list

| Environments |
| ------------ |
| *staging     |
| prod         |
| dev          |

$ amplify env checkout dev
🛑 Environment name is invalid.

Resolution: Run amplify env list to get a list of valid environments.
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

$ amplify env remove dev
🛑 Environment name is invalid.

### Project Identifier

9c7d61f53c3a284800d8323f74ba9f02

### Log output

_No response_

### Additional information

Related issue: https://github.com/aws-amplify/amplify-cli/issues/12557

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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Hey @kolodi glad to hear you’re back up and running! You can likely modify the Retain policy in a storage override to allow it to be deleted, however I can empathize where you would expect it to be cleaned up after a failed deployment. In any event, I will close this issue for now as resolved and make note of the cleanup issue for further improvements!