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.

Upgrading to 3.3.0 from 3.3.0-next.62 breaks proxied ws connections

See original GitHub issue

Downgrading back to react-scripts@3.2.0 fixes this. It will be fixed soon.

Describe the bug

For the past week I’ve been working with react-scripts@3.3.0-next.62 to use typescript 3.7 features. I just upgraded to 3.3.0 as it was just released. (EDIT: Upgrading to 3.3.0-next.80 causes the same issue as 3.3.0)

My application uses the package.json proxy setting to proxy both http and ws connections. This has been working fine, but upgrading to 3.3.0 causes the socket connections to break. Downgrading to 3.3.0-next.62 causes it to start working again.

Did you try recovering your dependencies?

Yes - I deleted node_modules and package-lock.json and reinstalled. The same result was encountered. I am also on the latest npm version (which still works with 3.3.0-next.62

Which terms did you search for in User Guide?

I searched for websocket proxy issues - the closest I found was issue 6497 but this does not seem to be the same.

Environment

System:
    OS: Windows 10 10.0.18362
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 13.3.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.13.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
    Internet Explorer: 11.0.18362.1
  npmPackages:
    react: ^16.12.0 => 16.12.0
    react-dom: ^16.12.0 => 16.12.0
    react-scripts: ^3.3.0 => 3.3.0
  npmGlobalPackages:
    create-react-app: Not Found

^ as a note to the above, I was on node 12 when I first encountered this error, but checked if an upgrade would resolve the problem.

Steps to reproduce

  1. Upgrade react-scripts with npm install --save-dev react-scripts@3.3.0
  2. Add a proxy value in package.json to match a local service that serves http and ws (eg. "proxy": "http://localhost:8080/")
  3. Ensure your web app makes some connection to the proxied websocket
  4. Run the app with npm start and view the app

Expected behavior

The proxied websocket connection should behave normally.

Actual behavior

Console logs output the following:

The connection to ws://localhost:3000/subscriptions was interrupted while the page was loading.
Firefox can’t establish a connection to the server at ws://localhost:3000/subscriptions.

in Chrome, a similar log is output:

WebSocket connection to 'ws://localhost:3000/subscriptions' failed: Error during WebSocket handshake: Unexpected response code: 400

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:35
  • Comments:27 (6 by maintainers)

github_iconTop GitHub Comments

14reactions
dankolesnikovcommented, Jan 10, 2020

Guys, this just broke our app… Don’t push broken code, please and thank you.

13reactions
danielkczcommented, Jan 10, 2020

@dankolesnikov You have never pushed broken code right? If you are that great, good for you, but others are just humans that do mistakes.

You can be also more proactive with your brilliant mind and fix the problem instead of waiting for others to do it, you know?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protocol upgrade mechanism - HTTP - MDN Web Docs - Mozilla
The HTTP/1.1 protocol provides a special mechanism that can be used to upgrade an already established connection to a different protocol, ...
Read more >
ws: a Node.js WebSocket library - npm
How to get the IP address of the client? How to detect and close broken connections? How to connect via a proxy? Changelog;...
Read more >
Using NGINX as a WebSocket Proxy
Learn how to use NGINX as a reverse proxy and load balancer for ... from HTTP to WebSocket uses the Upgrade and Connection...
Read more >
Troubleshooting connection issues | Socket.IO
Problem: the socket is not able to connect​. Possible explanations: You are trying to reach a plain WebSocket server; The server is not ......
Read more >
Express & HPM - 404 Not Found & Client Disconnected w ...
ws -proxy; server. Non-websocket (HTTP) requests work fine. This is with HPM v2 and Node.js v16. Update 1 After ...
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