amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

amplify init fails with read cannot property 'length' of undefined (Enviroment step)

Open gridknight opened this issue 7 years ago • 11 comments

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

  1. I installed the latest version of aws-amplify/cli with npm install -g @aws-amplify/cli
  2. I run amplify configure and configured a new user
  3. Inside my vue project I run:
  • npm i aws-amplify
  • npm i aws-amplify-vue
  1. Inside my vue project I run amplify init
  2. In Enter a name for the project I pressed ENTER since the name was correct (doc)
  3. 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:

gridknight avatar Aug 28 '19 10:08 gridknight

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"

wendtcode avatar Aug 28 '19 17:08 wendtcode

I'm having the same issue on a MacBook

davispeixoto avatar Aug 28 '19 17:08 davispeixoto

Any workaround until a fixed version is released?

blevine avatar Aug 28 '19 19:08 blevine

@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 avatar Aug 28 '19 19:08 yuth

@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

gridknight avatar Aug 28 '19 21:08 gridknight

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

yuth avatar Aug 28 '19 22:08 yuth

@blevine , one workaround that worked for me was using "test" as environment name. Not sure why it was accepted, but it was.

davispeixoto avatar Aug 29 '19 13:08 davispeixoto

This is still an issue for me on cli version 2.0.0.

Screen Shot 2019-08-30 at 9 45 43 AM

dsmrt avatar Aug 30 '19 15:08 dsmrt

@dsmrt we released the fix. Please install the latest version of Amplify CLI and you should not face this issue

yuth avatar Aug 30 '19 20:08 yuth

Updating to 3.0.0 fixed it. Thanks!

dsmrt avatar Aug 30 '19 22:08 dsmrt

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.

github-actions[bot] avatar May 27 '21 03:05 github-actions[bot]