amplify init fails with read cannot property 'length' of undefined (Enviroment step)
When I run >amplify configure inside a vue project I get:
Enter a name for the environment DEVCannot read property 'length' of undefined in the second step and the program exists.
To Reproduce
- I installed the latest version of aws-amplify/cli with
npm install -g @aws-amplify/cli - I run
amplify configureand configured a new user - Inside my vue project I run:
npm i aws-amplifynpm i aws-amplify-vue
- Inside my vue project I run
amplify init - In Enter a name for the project I pressed ENTER since the name was correct (doc)
- In Enter a name for the environment I tried:
- NONE
- Pressing ENTER
- "DEV"
- DEV
- 'DEV' all resulting in Cannot read property 'length' of undefined
Desktop (please complete the following information):
- OS: Windows
Software installed above resulted in:
- [email protected]
- [email protected]
- @aws-amplify/[email protected]
I encounter the same problem when trying to use amplify add api... I select GraphQL as my option, then press ENTER on the "Provide API name:" question because the name is correct. I always get the error "Cannot read property 'length' of undefined"
I'm having the same issue on a MacBook
Any workaround until a fixed version is released?
@blevine this happens when the validation of inputs throw error. Workaround for init is to have environment name in all small case letter and not include special chars or number. For api name, don't include the special chars
@yuth I tried it with dev small as well (I have no environment set) to which the environment must match? This was not necessary in previous versions. Thanks a lot
This was not necessary in previous versions.
What was the version of Amplify CLI that you had installed? Amplify CLI added support for Multi Environment in v1.0 and would have migrated the project created with pre 1.0 automatically
@blevine , one workaround that worked for me was using "test" as environment name. Not sure why it was accepted, but it was.
This is still an issue for me on cli version 2.0.0.

@dsmrt we released the fix. Please install the latest version of Amplify CLI and you should not face this issue
Updating to 3.0.0 fixed it. Thanks!
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.