tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 214 forks source link

Cannot read property 'mask' of undefined #316

Closed Flpph closed 5 years ago

Flpph commented 5 years ago

Actual behaviour:

Can't connect to the server

Expected behaviour:

To log in

Error log:

1|index    | [17:47] info: Connecting to irc-ws.chat.twitch.tv on port 80..
1|index    | [17:47] info: Sending authentication to server..
1|index    | TypeError: Cannot read property 'mask' of undefined
1|index    |     at Sender.frameAndSend (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:206:18)
1|index    |     at /opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:126:12
1|index    |     at Sender.applyExtensions (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:287:5)
1|index    |     at /opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:120:10
1|index    |     at Sender.flush (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:268:3)
1|index    |     at Sender.send (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/Sender.js:130:8)
1|index    |     at WebSocket.send (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/WebSocket.js:266:18)
1|index    |     at client._onOpen (/opt/EsporthuBot/node_modules/tmi.js/lib/client.js:947:17)
1|index    |     at WebSocket.onOpen (/opt/EsporthuBot/node_modules/tmi.js/node_modules/ws/lib/WebSocket.js:432:14)
1|index    |     at WebSocket.emit (events.js:182:13)

Server configuration

devolution2409 commented 5 years ago

I have a similar problem preventing me from logging in (related to presumably the websocket they are using), i'm opening a new issue as it is not the same exact error

CaptEmulation commented 5 years ago

tmi.js depends on ws@1.0.1 which lists bufferutils@1.2.x as a devDependency. What I am seeing is that when tmi.js is co-located in a project with another websockets implementation that picks up a newer bufferutils (the API has changed significantly over the years) then it does not install the bufferutils from devDependency but will allow ws to resolve the newer bufferutils. This will fail. The only options I see are to remove any other websocket dependent library from your project or to upgrade ws in tmi.js to a newer version.

CaptEmulation commented 5 years ago

It looks like dependencies were updated on master but not yet published. Try:

npm i --save git+https://git@github.com/tmijs/tmi.js
CaptEmulation commented 5 years ago

Nevermind, it looks like the dependency upgrade has been reverted: https://github.com/tmijs/tmi.js/commit/ca3f16a0eb66ea76fe76ebc3e703fa78507f001a

Too bad. It was working for my use case. @AlcaDesign what is the problem with the latest upgrade? Am willing to help....

AlcaDesign commented 5 years ago

I could not get the tests to pass with those dependencies. No matter what I tried I couldn't figure it out. It was a mistake to push it to Github so I reverted it. You can still get the code at that commit if you wish.

npm install https://github.com/tmijs/tmi.js#4dcfa551 I believe.

If you can correctly update the dependencies and have the tests pass, I can publish it.

Flpph commented 5 years ago

Worked after this:

npm install https://github.com/tmijs/tmi.js#4dcfa551

SnareChops commented 5 years ago

@AlcaDesign Submitted pull request for dependency update of ws only. All tests pass. Thanks in advance