Karma: TypeError: Cannot read property 'unmask' of undefined (Socket.io)

Created on 7 Mar 2017  路  10Comments  路  Source: karma-runner/karma

With a fresh npm install I am suddenly seeing an error to do with Karma's socket.io code. This is across different browsers (Chrome / PhantomJS) and systems (macOS / Ubuntu).

Expected behaviour

Karma starts, loads browser, connects to browser and then runs tests.

Actual behaviour

Karma starts, loads browser, and fails to connect to browser, instead receiving a syntax error:

START:
06 03 2017 16:39:59.624:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
06 03 2017 16:39:59.626:INFO [launcher]: Launching browser Chrome with unlimited concurrency
06 03 2017 16:39:59.652:INFO [launcher]: Starting browser Chrome
06 03 2017 16:40:00.582:ERROR [karma]: TypeError: Cannot read property 'unmask' of undefined
    at Receiver.unmask (/Users/petemill/Development/Makook/dmktplc/admin-web/node_modules/engine.io/node_modules/ws/lib/Receiver.js:306:46)
    at Receiver.finish (/Users/petemill/Development/Makook/dmktplc/admin-web/node_modules/engine.io/node_modules/ws/lib/Receiver.js:505:25)
    at Receiver.expectHandler (/Users/petemill/Development/Makook/dmktplc/admin-web/node_modules/engine.io/node_modules/ws/lib/Receiver.js:493:33)
    at Receiver.add (/Users/petemill/Development/Makook/dmktplc/admin-web/node_modules/engine.io/node_modules/ws/lib/Receiver.js:103:24)
    at Socket.realHandler (/Users/petemill/Development/Makook/dmktplc/admin-web/node_modules/engine.io/node_modules/ws/lib/WebSocket.js:825:20)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)
npm ERR! Test failed.  See above for more details.

Environment Details

  • Tested on 1.4.x and 1.5.x

Steps to reproduce the behaviour

  1. Latest version of karma, karma-coverage, karma-mocha and karma-chrome-launcher
  2. Run karma

Most helpful comment

A workaround that works for me:

  • remove old node_modules/
  • run npm install --no-optional

This will prevent the "offenders" bufferutil and utf-8-validate from being installed. Everything should still work.

All 10 comments

Can ignore this - weird coding in ws package can cause conflict if more modern version of bufferutil and utf-8-validate packages are installed

@petemill I have the same issue. So what is the suitable version of bufferutil and utf-8-validate ?
I'm using 3.0.0 for bufferutil and 3.0.1 for utf-8-validate

I also have the same issue after upgrading to a newer angular-cli (and updating karma). What's the solution? :)

@creat-or I downgraded the dependencies version for bufferutil and utf-8-validate and it worked.

Related: https://github.com/socketio/engine.io/pull/495

From what I can tell this should be fixed by getting rid of ws 1.1.2 and using ws 1.1.4 instead.

As soon as the new version of engine.io is released, can you guys update the dependency?

I'm having the same issue as @MiraLak . Using same dependencies 3.0.0 for bufferutil and 3.0.1 for utf-8-validate (socket.io 1.7.3).
What did you do to fix it? Downgraded what to what?
Should I need to downgrade it in socket.io node_modules or in my app package.json?

A workaround that works for me:

  • remove old node_modules/
  • run npm install --no-optional

This will prevent the "offenders" bufferutil and utf-8-validate from being installed. Everything should still work.

Hi, have the same issue and still nobody answered to previous question "Downgraded what to what?" and workaround doesn't work for me )

2880 ought to fix this issue.

Is there a plan when are you going to release this fix? This is a pretty serious issue for us because all of our unittests are failing.

Or is there any documentation about your release cycle or release plans?
Sorry if I'm missing something but I couldn't find anything about this.

Thanks

Was this page helpful?
0 / 5 - 0 ratings