question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error during WebSocket handshake: Unexpected response code: 400

See original GitHub issue

Why error after migrate from v2.2.0 to v2.4.0 ??? Error during WebSocket handshake: Unexpected response code: 400

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
willyprayogo26commented, Jan 7, 2021

Hi, we also encountered the same error yesterday, indeed it was linked to CORS. We updated socket.io from 2.3 to 2.4, and suddenly we had an error 400: Bad request. After fixing CORS everything worked fine. One interesting thing: by coincidence we had transports set to only ['websocket'], so it took a while to figure out that the problem was CORS: if the pooling fallback is enabled it is displayed on the console of the browser an error of the type Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3030/socket.io/?EIO=3&transport=polling&t=NROEP-d. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). , so it is easy to understand that the problem are missing CORS headers. But if you have only the websocket transport enabled, a generic error 400: Bad request is raised. I don’t know if it would be possible to have a more descriptive error to point users in the right direction even if they are using only the websocket trasport. Cheers

Thanks for the information 👍

0reactions
darrachequesnecommented, Feb 23, 2021

The change included in socket.io@2.4.0 was reverted in socket.io@2.4.1: https://github.com/socketio/socket.io/releases/tag/2.4.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket connection failed: Error during ... - Stack Overflow
WebSocket connection failed : Error during WebSocket handshake: Unexpected response code: 400 · Ask Question. Asked 5 years, 11 months ago.
Read more >
Error during WebSocket handshake: Unexpected ... - GitHub
Error during WebSocket handshake: Unexpected response code: 400 · Issue #1942 · socketio/socket.io · GitHub.
Read more >
Error during WebSocket handshake: Unexpected response ...
WebSocket connection to 'wss://mydomain/openvidu' failed: Error during WebSocket handshake: Unexpected response code: 400 - Issues with deployment - OpenVidu.
Read more >
Error during WebSocket handshake: Unexpected response code
I updated server from 2017 R2 to 2019 R1. and tried to open my web app. my web app uses mobile SDK and...
Read more >
Please help! Can't open websocket, and Error during ...
Searching for "400" in https://github.com/tornadoweb/tornado/blob/master/tornado/websocket.py shows that this response code is used when the "Upgrade: websocket ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found