mapbox / mapbox/cfn-stack-event-stream

Cannot read property 'length' of undefined on data.StackEvents

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Looks like [data.StackEvents can be undefined](https://github.com/mapbox/cfn-stack-event-stream/blob/e53afb2594869422def882c44221826ef7146040/index.js#L27), and not have a error set

```
/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:30
throw err;
^
TypeError: Cannot read property 'length' of undefined
at Response. (/usr/local/lib/node_modules/mapbox-cli/node_modules/cfn-stack-event-stream/index.js:27:49)
at Request. (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:353:18)
at Request.callListeners (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:595:14)
at Request.transition (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:21:10)
at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:37:9)
at Request. (/usr/local/lib/node_modules/mapbox-cli/node_modules/aws-sdk/lib/request.js:597:12)
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in index.js at line 27, where the stack event response is accessed, and compare the undefined data.StackEvents case with the error information in the issue. Reproduce the AWS response that triggers the exception and verify that completion no longer calls length on missing data while the failure is surfaced appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.