Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
petemill opened this issue Mar 7, 2017 · 10 comments · Fixed by karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@petemill
Copy link

petemill commented Mar 7, 2017

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
@petemill
Copy link
Author

petemill commented Mar 7, 2017

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 petemill closed this as completed Mar 7, 2017
@MiraLak
Copy link

MiraLak commented Apr 14, 2017

@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

@27leaves
Copy link

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

@MiraLak
Copy link

MiraLak commented Apr 19, 2017

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

@magnattic
Copy link

Related: socketio/engine.io#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?

@RobotnickIsrael
Copy link

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?

@magnattic
Copy link

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.

@Sashikus
Copy link

Sashikus commented Jun 6, 2017

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

@skylarjhdownes
Copy link

#2880 ought to fix this issue.

@tujlaky
Copy link

tujlaky commented Dec 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants