0.5.5: `serverless project create` crashes on empty profile selection #1005

Closed
markstos opened this Issue Apr 14, 2016 · 1 comment

Projects

None yet

3 participants

@markstos

Running on Node.js 4.4.1.

To reproduce is simple:

  • Run serverless project create
  • Press enter 4 times.

The following stack trace results. I believe this is because "Existing Profile" was selected. There is no profile, but the code lacks error checking for this case, resulting an attempted action called on an undefined value.

$ serverless project create
 _______                             __
|   _   .-----.----.--.--.-----.----|  .-----.-----.-----.
|   |___|  -__|   _|  |  |  -__|   _|  |  -__|__ --|__ --|
|____   |_____|__|  \___/|_____|__| |__|_____|_____|_____|
|   |   |             The Serverless Application Framework
|       |                           serverless.com, v0.5.5
`-------'

Serverless: Initializing Serverless Project...  
Serverless: Enter a name for this project:  (serverless-b1fkml) 
Serverless: Enter a new stage name for this project:  (dev) 
Serverless: For the "dev" stage, do you want to use an existing Amazon Web Services profile or create a new one?
  > Existing Profile
    Create A New Profile
Serverless: Select a profile for your project: 
/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/utils/cli.js:386
      if (Select.state.choices[Select.state.index - 1].action
                                                      ^

TypeError: Cannot read property 'action' of undefined
    at ReadStream.keypressHandler (/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/utils/cli.js:386:55)
    at emitTwo (events.js:87:13)
    at ReadStream.emit (events.js:172:7)
    at emitKey (/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/node_modules/keypress/index.js:406:12)
    at ReadStream.onData (/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/node_modules/keypress/index.js:48:14)
    at emitOne (events.js:77:13)
    at ReadStream.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at ReadStream.Readable.push (_stream_readable.js:111:10)
    at TTY.onread (net.js:529:20)
@eahefnawy eahefnawy closed this in 4673488 Apr 25, 2016
@imhassan
imhassan commented Jun 8, 2016

Getting this errror node -v = 6.2.1

`serverless project create -c true


| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| || -| _| | | -| _| | -|_ --|__ --|
|____ ||| _/||| ||||_____|
| | | The Serverless Application Framework
| | serverless.com, v0.5.5
`-------'

Serverless: Initializing Serverless Project...
Serverless: Enter a name for this project: (serverless-hy6y16) TwilioIntegration
Serverless: Enter a new stage name for this project: (dev) prod
Serverless: For the "prod" stage, do you want to use an existing Amazon Web Services profile or create a new one?
Existing Profile

Create A New Profile
Serverless: Select a profile for your project:
/usr/local/lib/node_modules/serverless/lib/utils/cli.js:386
if (Select.state.choices[Select.state.index - 1].action
^

TypeError: Cannot read property 'action' of undefined
at ReadStream.keypressHandler (/usr/local/lib/node_modules/serverless/lib/utils/cli.js:386:55)
at emitTwo (events.js:106:13)
at ReadStream.emit (events.js:191:7)
at emitKey (/usr/local/lib/node_modules/serverless/node_modules/keypress/index.js:406:12)
at ReadStream.onData (/usr/local/lib/node_modules/serverless/node_modules/keypress/index.js:48:14)
at emitOne (events.js:96:13)
at ReadStream.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at ReadStream.Readable.push (_stream_readable.js:130:10)
at TTY.onread (net.js:542:20)
`

@license2e license2e pushed a commit to license2e/serverless that referenced this issue Aug 24, 2016
@eahefnawy eahefnawy + Ilya Shindyapin fix validation for non existing aws profile. Closes #1005 a87ad47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment