GAwesomeBot / bot

A super Awesome Discord bot
https://gawesomebot.com
GNU General Public License v2.0
391 stars 185 forks source link

[BUG] bufferUtil error when accessing admin console. #81

Closed darcien closed 7 years ago

darcien commented 7 years ago

OS: Arch Linux Branch: master and development node version: 6.2.2, 6.9.5, 7.5.0 socket.io version: 1.4.8, 1.7.2

Bot runs normally until I tried to change any options like command options from the admin console. The same error instantly happened without opening or refreshing the admin console page when restarting the bot.

/home/lealith/GAwesomeBot/node_modules/engine.io/node_modules/ws/lib/Receiver.js:306
  if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
                                             ^

TypeError: Cannot read property 'unmask' of undefined
    at Receiver.unmask (/home/lealith/GAwesomeBot/node_modules/engine.io/node_modules/ws/lib/Receiver.js:306:46)
    at Receiver.finish (/home/lealith/GAwesomeBot/node_modules/engine.io/node_modules/ws/lib/Receiver.js:505:25)
    at Receiver.expectHandler (/home/lealith/GAwesomeBot/node_modules/engine.io/node_modules/ws/lib/Receiver.js:493:33)
    at Receiver.add (/home/lealith/GAwesomeBot/node_modules/engine.io/node_modules/ws/lib/Receiver.js:103:24)
    at Socket.realHandler (/home/lealith/GAwesomeBot/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)
vladfrangu commented 7 years ago

From what I've heard, you're using the master branch. Can you try switching to the development branch and try again? (Which also means you'll have to re-build your DB and config.json)

medmedmeddia commented 7 years ago

I'm experiencing this as well. I tried switching to the development branch but I the same thing happened :/

OS: Debian 8 Node Version: 7.5.0 Socket.io Version: 1.7.2

darcien commented 7 years ago

Just now I tried using the latest development branch, still having issue.

vladfrangu commented 7 years ago

Right, from what it seems, it might be a OS-based issue. I'll test the systems locally and see if thats the case and let you know, ok?

vladfrangu commented 7 years ago

Right, this might sound dumb, but:

Can you go to node_modules/engine.io/node_modules/ws and run npm install

Gilbert142 commented 7 years ago

That does sound a little dumb... When running npm install npm checks all your dependencies (here engine.io) and installs THEIR dependencies aswell.

So really, when you run npm install while being in GAB's root folder npm already automaticly runs npm install in all the node_modules' folders (in a way, not exactly, but just to give you the idea)

vladfrangu commented 7 years ago

Except that, it didn't apply on my local debian 8 VM. I don't know if node knows how to handle modules outside of the folder. Aka, if the requirement for engine.io is bufferUtils, it won't find outside the folder. So, each module needs its own node_modules.

Yes, it sounds dumb, but what if it works? We gonna test it before, right?

darcien commented 7 years ago

Actually it's working, I tried it and the bot no longer crashed when accessing the admin console. I searched similar issues like this and seems like there's a bug where npm doesn't install all of it's modules dependencies.

Gilbert142 commented 7 years ago

Hm-hm, npm is not behaving as expected in that case. A third-party issue, then.