-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Error: no handler for opcode 7 #919
Comments
You are receiving invalid frames. Opcodes 0x03-0x07 are reserved so you get an error. |
hmmm, weird, how can i debug best what's invalid about them? are there any specs saying that opcode 7 exactly means? i am using them for a heavily used API and am thinking of DOS attacks or other hack attempts. hence very curious here ... |
The spec doesn't say much, it only says that those opcodes are reserved for further non-control frames, see https://tools.ietf.org/html/rfc6455#section-5. |
Thanks for the link. Chapter 5.8 Extensibility also says they can be used for more capabilities. How would you debug this best? Really curious here about their contents. |
Yeah but the extension must be negotiated first. |
Hmmm, thanks. And what about the other question, how can I investigate + debug this best? |
What do you mean with "debug"? I'm not sure if this is done on purpose or it is the result of a faulty client. What you can do is log as much as you can when you get this error. |
Can't say if on purpose or faulty. Log as much as I can? I already do but not much on the websocket level. Do you think it would be possible to wrap more information in errors thrown from For example I am curious who the sender is. What the recent buffer contents were. And so on. |
You can get some valuable info about the sender when you get the error as the ws.on('error', (err) => {
if (err.message === 'no handler for opcode 7') {
console.log(ws.upgradeReq.connection.remoteAddress);
// or check the headers if you are behind a reverse proxy
}
}); The buffer contents is simply discarded when you get the error, you may be able to read it but you have to monkey patch the |
Closing this, please comment if needed. |
This also appears to be occasionally crashing a node server we run in production. Ideally the server will not crash if somebody sends it something invalid. This is a pretty nasty DOS vector. Shouldn't the server handle this reliably by default? |
@AshleyScirra it will not crash if you add, and you should, an |
Throwing on not handled errors is default Node.js behavior. |
Seeing this error + stack trace when using websocket-stream v3.3.3
Any clues what this can be?
The text was updated successfully, but these errors were encountered: