browserstack/browserstack-local-nodejs

Throws: Cannot read property 'message' of undefined in error handler

Opened this issue · 2 comments

Expected Behavior

Be able to run browserstack/karma-browserstack-example after updating the dependencies as done in PR: browserstack/karma-browserstack-example#4.

Actual Behavior

Karma catches an error (thrown by browserstack-local:
28 01 2020 21:48:06.733:ERROR [karma-server]: UncaughtException

Steps to Reproduce the Problem

Run the example with PR: browserstack/karma-browserstack-example#4

browserstack local arguments

Platform details

  1. browserstack-local-nodejs version: master branch, 1.4.5, d238484
  2. node version: 10.16.3
  3. os type and version: Linux Fedora 30

Details

Karma catches an error:
28 01 2020 21:48:06.733:ERROR [karma-server]: UncaughtException

caused by, Throws: Cannot read property 'message' of undefined in error handler in:

callback(new LocalError(data['message']['message']));

where

data = {}
TypeError: Cannot read property 'message' of undefined
    at /home/borewit/code/github/browserstack-local-nodejs/lib/Local.js:65:50
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:198:13)
    at Pipe._handle.close (net.js:606:12)

Proposed fix: #97

@Borewit I was unable to replicate the error using shared repo. To confirm if this is not caused by a corrupted binary could you try deleting the binary then execute the tests.

for Linux/Mac the binary is located at /Users/username/.browserstack

This issue might have been caused by an older version of the browserstack executable. Yet the error handling should not throw another error.