-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: WebSocket connection closed (in cypress 13.6) #28523
Comments
Having the error, it's quite annoying, we decided to downgrade to |
Hi, same issue too: downgraded to 13.5.1. |
Could someone run Cypress in debug mode mode and print the entire set of logs here? That would help determine where it might be happening. Is this only happening when using the Module API? Or a specific way of running Cypress? (headed, headless, run, open, specific browsers?) |
on our end:
|
We're encountering the same issue and I run the cypress test with debug logs. We're using cypress version 13.6.1 where we encountered the issue.
After downgrading the cypress version to 13.5.1, we no longer encounter the websocket connection close issue. Looking forward for a fix for this. |
@allenbilar Thanks for providing the debug logs. This narrows down the area we should be looking in I believe. It seems to be related with our browser tab closing logic. It would be great to have a reproducible example to narrow in further. Does this happen randomly at the end of any spec? Or at the same spot each time? |
@jennifer-shehane at the same spot each time. |
Any update on fixing this issue ? The issue still persist in v13.6.2. |
@DanielPhangHL We don't have a way to reproduce this issue, so haven't been able to investigate. Could someone provide a way to reproduce the issue? |
@jennifer-shehane which debug logs do you need? |
@jennifer-shehane I narrowed it down to a single test. The last thing it does it clicks on a button which in place should render a chart. It works perfectly fine when tested manually
|
I saw this yesterday for the first time. The changes we did recently
|
I'm attempting an upgrade to Cypress 13.6.2 and seem to be running into this issue myself as well. I don't have a reproducible example to provide either at this time but curious to see what can be said given the information that others have provided. 👀 |
@vasilev-alex Could you provide the code to run that single test? Or a similar test that recreates the same behavior? |
@jennifer-shehane it doesn't do anything fancy, just clicks a button, which in turn loads another "app" which is in iframe. I guess this might be an issue |
Our problematic test involves an iframe as well... no clicking though. Just visiting a page that happens to contain an iframe and doing some assertions on the static page. it('Error: WebSocket connection closed', function () {
cy.visit('https://share.vidyard.com/watch/mR7nXEXcdnRMCyYG52bVxj');
cy.get('#vidyard-logo')
.find('img')
.should('be.visible');
cy.get('head link[rel*="icon"]')
.should('have.attr', 'href', '/favicon.ico');
cy.get('#get-vidyard-free-cta')
.should('be.visible')
.and('have.text', 'Sign Up for Free');
cy.get('body')
.should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('#name-header')
.find('h1')
.should('be.visible')
.and('have.text', 'Paint Squiggles');
cy.get('#email-signup-button')
.should('be.visible')
.and('have.text', 'Sign up with Business Email');
const socialLogins = [
'#google-signup-button',
'#outlook-signup-button',
];
socialLogins.forEach((element) => {
cy.get(element)
.should('be.visible');
});
}); The test itself passes but after it does we occasionally see |
Any update on this? thanks! |
@todd-m-kemp I ran this example several times on my Mac and didn't encounter this error. I tried running via the Module APi also. Could you give more specifics about how and where you're running this test to see the error?
|
@jennifer-shehane: I'm happy to answer as best as I can.
As far configuration/options/flags, can you be more specific? I'm not quite sure how to answer that question. |
@jennifer-shehane we are facing the same issue. Test code to reproduce Cypress Version Node version Operating System Debug Logs Other On Cypress 13.3.0 On Cypress 13.6.2 Again our tests completes, but once its start generating the video failed. Both cases above are visible only in CircleCI |
We were experiencing the same, having this randomly appear on different tests, but we got to completely "solve" this by downgrading cypress to We also tried version 13.6.3 after that to see if it had fixed this, but the error reappeared after that, so we downgraded again. We assumed it was something related to the chrome version used by cypress, but tbh I don't remember right now why, but hopefully this could be useful somehow |
@jennifer-shehane we remove the video recording after every test and voalya, we stop seeing the nasty socket error. Please check why this is happen. |
@newsuk-apnikolov There are a couple of causes of the websocket error that we can notice from this thread. Yours definitely has something to do with video compression. Some others examples are happening around the time the spec ends/browser closes. We do have this on our radar to investigate further. A clear way to reproduce 100% of the time would speed up our investigation, but I know it's mostly intermittent for everyone. |
We have around 100 cypress tests in our project and after upgrading to any version later than 13.5.1 (our current version) some tests start to fail due to that same issue (websocket disconnect) I'm not sure if I can find a specific case that causes this but it seems like all tests now have a chance to crash due to this issue Unfortunately we had to rollback to 13.5.1 until this is fixed |
finally I can confirm downgrading ti 13.5.1 works. sorry for the late answer. |
I tested on v.13.7.0 and this problem still persist. |
We are intending to look into this in our upcoming sprint. |
I also started seeing the issue sometimes for the first time a few days ago (we upgraded from
|
We have hit this exact same issue much more frequently over the past 2 months. |
running in jenkins with video enabled same error here |
We were running Cypress version |
@jennifer-shehane any updates on this? Also running into this issue more consistently. This is becoming a huge issue for our team considering we are burning CI spend on these failures with unnecessary re-runs. |
Thank you everyone for all of your input, especially with stack traces and which version of Cypress. I believe I have identified the source of this error, and will be working on fixing it. According to stack traces, the uncaught exception is being thrown from It looks like I have yet to be able to reproduce this myself, so I cannot yet write regression tests or implement a fix. If the CRI change caused the issue, it may lead to me being able to reproduce this error. However, to expedite this, if anyone can fork https://github.com/cypress-io/cypress-test-tiny or https://github.com/cypress-io/cypress-realworld-app and reproduce the error (even sporadically), that would greatly expedite this process. |
The problem still exists. Additionally, it has been occurring for so long that we have started rewriting tests in Playwright. |
Hi everyone, Thank you for your patience while I look into this. In order to aid with resolving it, we are still requesting a directly runnable test scenario that will reproduce the error. If you cannot provide a repository that reproduces the issue, please see the bottom of this comment for a specific selection of debug logs that will help me investigate. @todd-m-kemp , sadly, I was unable to reproduce with that test snippet. I tried running this test via the module API in a docker container built from the This appears to be a race condition. Cypress sends a CDP command to the browser, and then closes the browser while that command is still pending a response. We do need help tracking down which command(s) are involved in this. If this issue is occurring for you, please try to provide us with this selection of debug logs:
Please note that these logs will be quite long. Please review them for potentially sensitive information before posting them. Thank you so much for your help in tracking this down! |
We've noticed this only occurs in our CircleCI environment (but occurs pretty regularly there), we have parallelization enabled there. Locally it never occurs for us. |
bit long but hopefully it'll help. |
Hi @Squixx , thank you for those debug logs! It looks like you're encountering a different error:
The debug logs I requested are specifically for helping with the Can you open a new issue and attach a minimal reproduction example? A fork of https://github.com/cypress-io/cypress-test-tiny tends to work best to get a minimum reproduction. |
Minimum reproduction for that will probably be just as hard as the websocket one.. but i'll move that to a different issue if it keeps poping up.
this log should be more relevant. Lets focus on 1 problem at a time |
@cacieprins: we encounter this problem happening with CY |
We also got this error on 13.7.3 as well. This is in Azure with windows-latest Agent. I know it's not full logs but just adding for environment difference than some of the others as well as visibility into the thread. We had been on 13.6.4 up until Monday when we updated to 13.7.3 and I now saw this issue. I also noticed that after updating, the runner is randomly skipping large quantities of tests. A pipeline that executes 120 tests on a normal night has done 7 and 14 the past couple runs and it just says tests were skipped despite us not changing anything to drive that behavior. Probably a separate issue but maybe a symptom of something. |
We downgraded to 13.6.4 last week and our nightly test execution went back to running nominally. |
Hi everyone, thank you for the expanded logs! It looks like this is a combination of things:
I have a tentative fix in review. I've built pre-release packages from that branch. If you would like to try them out, please follow the instructions for using prerelease binaries: linux x64 npm install https://cdn.cypress.io/beta/npm/13.8.1/linux-x64/cacie/fix/websocket-closed-59a1198c5c1b222d81f33131d680ca08009dde5b/cypress.tgz linux arm64 npm install https://cdn.cypress.io/beta/npm/13.8.1/linux-arm64/cacie/fix/websocket-closed-59a1198c5c1b222d81f33131d680ca08009dde5b/cypress.tgz darwin arm64 npm install https://cdn.cypress.io/beta/npm/13.8.1/darwin-arm64/cacie/fix/websocket-closed-59a1198c5c1b222d81f33131d680ca08009dde5b/cypress.tgz darwin x64 npm install https://cdn.cypress.io/beta/npm/13.8.1/darwin-x64/cacie/fix/websocket-closed-59a1198c5c1b222d81f33131d680ca08009dde5b/cypress.tgz windows npm install https://cdn.cypress.io/beta/npm/13.8.1/win32-x64/cacie/fix/websocket-closed-2add9c20e9f9e443e21b2037b1007118ff763c24/cypress.tgz Thank you again for your patience while we work through this! |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
Cypress reports
Error: WebSocket connection closed
and then stops running tests andcypress.run
returns withMore context:
Desired behavior
Don't throw errors. Or give more information as to why the errors are happening.
Test code to reproduce
not sure how to reproduce; happens sporadically but consistently
Cypress Version
13.6.1
Node version
18.16.1
Operating System
linux/docker (CI/CD)
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: