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.

CRA/react-scripts v5, Mac Monterey: Cypress component test crashes with error RangeError: Invalid WebSocket frame: RSV1 must be clear

See original GitHub issue

Current behavior

This repo is using CRA & react-scripts v5 with a minimal Cypress 10 install. There is a simple component test that mounts the app.

On running the test, we get a crash on MacBook Pro, Mac Monterey 12.4, Intel Core i9.

To reproduce:

git clone https://github.com/muratkeremozcan/cra5-cy10-test.git
cd cra5-cy10-test
nvm use
yarn install
yarn cy:open-ct

Works in CI. Works if we downgrade react-scripts to v4, however that is a blocker for component test code coverage. More data here. TL, DR; with react-scripts 5, we cannot configure webpack (as in this commit) so that we can get coverage from component tests.

image

Desired behavior

Component test do not crash on Mac Montery, with a repo using react-scripts v5.

More desired behavior is code coverage being included with component testing, as it used to be long time ago in the past.

Test code to reproduce

https://github.com/muratkeremozcan/cra5-cy10-test

git clone https://github.com/muratkeremozcan/cra5-cy10-test.git
cd cra5-cy10-test
nvm use
yarn install
yarn cy:open-ct

Cypress Version

10.3.0

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marktnoonancommented, Jul 21, 2022

@muratkeremozcan I gave this a shot and couldn’t reproduce either on my machine, how did you get on with @ZachJW34’s suggestion?

1reaction
ZachJW34commented, Jul 15, 2022

I couldn’t find any issues relating to webpack (and couldn’t reproduce this issue myself), but it has to be related since you said downgrading to cra4 fixed this. I did find a similar issue with Snowpack. Can you try overwriting your port to use something other than port 8080 (which is the default)? The config would look something like this:

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  component: {
    devServer: {
      framework: "create-react-app",
      bundler: "webpack",
      webpackConfig: {
        devServer: {
          port: 3000,
        },
      },
    },
  },
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: RSV1 must be clear #1140 - websockets/ws - GitHub
This error means that the client is sending a compressed frame but the permessage-deflate extension is disabled. There isn't anything actionable to do...
Read more >
RangeError: Invalid WebSocket frame: RSV1 must be clear
someone keeps trying to crash my WebSocket server, and this error keeps getting sent when they try. Is there any possible fix to...
Read more >
Invalid WebSocket frame: RSV1 must be clear - Monocle Forums
I am getting the 'Invalid WebSocket frame: RSV1 must be clear' error. I have already tried uninstalling and reinstalling.
Read more >
Server crashes with Invalid WebSocket frame: RSV1 must be ...
Server crashes with Invalid WebSocket frame: RSV1 must be clear.
Read more >
Uncaught RangeError: Invalid WebSocket frame - Reddit
It appears that you are attempting to open a raw socket connection to a server that is listening for websocket connections. I do...
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