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

Node.js and Socket.io UTF8 Validation TypeError coming from ws #1021

Closed
RayceRossum opened this issue Feb 28, 2017 · 3 comments
Closed

Node.js and Socket.io UTF8 Validation TypeError coming from ws #1021

RayceRossum opened this issue Feb 28, 2017 · 3 comments

Comments

@RayceRossum
Copy link

RayceRossum commented Feb 28, 2017

Getting this error when validating data received from the client through socket.io.

C:\Users\Rayce\Documents\SENG513\node-js-getting-started\node_modules\socket.io\node_modules\ws\lib\Receiver.js:532 6:23:55 PM web.1 | if (!Validation.isValidUTF8(messageBuffer)) { 6:23:55 PM web.1 | ^ 6:23:55 PM web.1 | TypeError: Cannot read property 'isValidUTF8' of undefined 6:23:55 PM web.1 | at C:\Users\Rayce\Documents\SENG513\node-js-getting-started\node_modules\socket.io\node_modules\ws\lib\Receiver.js:532:28 6:23:55 PM web.1 | at C:\Users\Rayce\Documents\SENG513\node-js-getting-started\node_modules\socket.io\node_modules\ws\lib\Receiver.js:368:7 6:23:55 PM web.1 | at C:\Users\Rayce\Documents\SENG513\node-js-getting-started\node_modules\socket.io\node_modules\ws\lib\PerMessageDeflate.js:249:5 6:23:55 PM web.1 | at afterWrite (_stream_writable.js:355:3) 6:23:55 PM web.1 | at onwrite (_stream_writable.js:346:7) 6:23:55 PM web.1 | at WritableState.onwrite (_stream_writable.js:89:5) 6:23:55 PM web.1 | at afterTransform (_stream_transform.js:79:3) 6:23:55 PM web.1 | at TransformState.afterTransform (_stream_transform.js:54:12) 6:23:55 PM web.1 | at Zlib.callback (zlib.js:613:5) [DONE] Killing all processes with signal null 6:23:55 PM web.1 Exited with exit code 1

Editing out this section of code in Receiver.js,
if (!Validation.isValidUTF8(messageBuffer)) { self.error('invalid utf8 sequence', 1007); return; }
stops the error from occuring but I would prefer a better solution as I'd like to use NPM and can't be bothered to redo this every time an update occurs.

I have also tried installing utf-8-validate into the node_modules folder of socket.io

@vonzimr
Copy link

vonzimr commented Apr 20, 2017

So, it appears you've closed, reopened, then closed this issue. I'm assuming you've solved this problem, then? Wanna enlighten us folks who are still having this problem?

@vonzimr
Copy link

vonzimr commented Apr 20, 2017

I figured out a fix that doesn't require deleting the if statement.
in Receiver.js which lives in in the socket.io/node_modules/ws folder,
set isValidUTF8 = require('./Validation'),
see the example here: https://github.com/websockets/utf-8-validate

I'm pretty sure there's something wrong with the version of utf-8-validate that's being installed for this library though, meaning this issue should still be open?

@lpinca
Copy link
Member

lpinca commented Apr 20, 2017

@vonzimr socket.io is using a version of ws which is not compatible with the latest version of utf-8-validate.

See socketio/engine.io#495.

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

No branches or pull requests

3 participants