aws-amplify / aws-amplify/amplify-cli

(cli@multienv) Amplify init should check for duplicate environment names

Open
#711 5 comments 0 reactions 0 assignees View on GitHub
feature-request multienv ops-multienv p4
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

**Describe the bug**

`amplify init` allows duplicate environments to be created locally that will fail on first `amplify push`. Ideally, it should detect this and fail on init.

**To Reproduce**
Steps to reproduce the behavior:
1. create an environment on a branch (using the beta version of amplify) and `amplify push`. Choose a name for the environment, say "dupenv"
2. `git checkout master` (without merging the other branch)
3. create a new branch, `amplify init`, and choose "dupenv" (or the same as you chose before) as the env name. Operation succeeds
4. `amplify push` - this will fail with an error including something like:

```
CREATE_FAILED S3Bucket...
projectname-20190103155640-hostingbucket-dupenv already exists
```

**Expected behavior**
Amplify should be able to detect this issue and fail on step 3 (init) with a more helpful error: "that environment name is already in use in stack arn:xxxx...". If you want to go further, amplify could offer to import the environment.

**Additional context**
This will only occur between unmerged branches. It is more likely if a developer wants to create an environment that they can reuse or in the context of learning amplify itself.

This might fit work-wise with #2364, which also relates to environment name validation.

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.