Skip to content
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

cy.recordHar() results in Websocket connection closed error messages #317

Open
krikkrob opened this issue Jul 18, 2023 · 3 comments
Open
Assignees
Labels
Type: bug Something isn't working

Comments

@krikkrob
Copy link

Description
After updating cypress-har-generator from version 5.3.7 to 5.16.4 I see a lot of error messages when performing test runs. Those error messages won't finish the test execution, but the error messages make it hard to consume. They are shown pretty much after every test.

Stack trace

CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.306. Reason: net::ERR_ABORTED
    ✓ should add and remove activity from activity list (12835ms)
CYPRESS-HAR-GENERATOR 49211: Session 8B0EE4B6FDD91BE4124A1868C5DD6386 associated with request: 50867.307
CYPRESS-HAR-GENERATOR 49211: Session 8B0EE4B6FDD91BE4124A1868C5DD6386 associated with request: 50867.308
CYPRESS-HAR-GENERATOR 49211: Session 8B0EE4B6FDD91BE4124A1868C5DD6386 associated with request: 50867.309
CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.307. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.308. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.309. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 49211: Session 8B0EE4B6FDD91BE4124A1868C5DD6386 associated with request: 50867.310
CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.310. Reason: net::ERR_ABORTED
CYPRESS-HAR-GENERATOR 49211: Chrome Debugging Protocol disconnected
CYPRESS-HAR-GENERATOR 49211: We encountered an issue while initializing the target for the session: 573D09E8A9BAE05B3DD0409419F304FE.
CYPRESS-HAR-GENERATOR 49211: The information about the target is as follows: {"targetId":"426A4FC284C64A86EBFE324497E998AB","type":"service_worker","title":"Service Worker https://xyz/desktop-notifications-service-worker.js?cdnDomain=xyz.xyz","url":"xyz?cdnDomain=xyz.xyz","attached":true,"canAccessOpener":false,"browserContextId":"99A5C94DD10A5994FBEBBF67F0575AA6"}
⚠ Unable to attach to the target (e.g. page, worker, etc). 

Possible reasons for the failure include:
  - Chrome not running in headless mode.
  - The target may have closed during initialization.
  - The target may have crashed due to memory issues.

Please open an issue on the repository: https://github.com/NeuraLegion/cypress-har-generator/issues for assistance.

The stack trace for this error is:
Error: WebSocket connection closed
    at /Users/xxx/git/smoke-tests/node_modules/chrome-remote-interface/lib/chrome.js:94:35
    at Chrome._handleConnectionClose (xyz/git/sre-smoke-tests/node_modules/chrome-remote-interface/lib/chrome.js:256:13)
    at WebSocket.<anonymous> (xyz/git/sre-smoke-tests/node_modules/chrome-remote-interface/lib/chrome.js:114:26)
    at Object.onceWrapper (node:events:628:26)
    at WebSocket.emit (node:events:513:28)
    at WebSocket.emit (node:domain:489:12)
    at WebSocket.emitClose (xyz/sre-smoke-tests/node_modules/ws/lib/websocket.js:246:10)
    at Socket.socketOnClose (xyz/node_modules/ws/lib/websocket.js:1148:15)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:301:12)
⚠ Unable to attach to the target (e.g. page, worker, etc). 

Possible reasons for the failure include:
  - Chrome not running in headless mode.
  - The target may have closed during initialization.
  - The target may have crashed due to memory issues.

Please open an issue on the repository: https://github.com/NeuraLegion/cypress-har-generator/issues for assistance.

The stack trace for this error is:
Error: WebSocket connection closed
    at /xyz/node_modules/chrome-remote-interface/lib/chrome.js:94:35
    at Chrome._handleConnectionClose (/xyz/node_modules/chrome-remote-interface/lib/chrome.js:256:13)
    at WebSocket.<anonymous> (xyz/node_modules/chrome-remote-interface/lib/chrome.js:114:26)
    at Object.onceWrapper (node:events:628:26)
    at WebSocket.emit (node:events:513:28)
    at WebSocket.emit (node:domain:489:12)
    at WebSocket.emitClose (/xyz/node_modules/ws/lib/websocket.js:246:10)
    at Socket.socketOnClose (xyz/node_modules/ws/lib/websocket.js:1148:15)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:301:12)
CYPRESS-HAR-GENERATOR 49211: We encountered an issue while initializing the target for the session: 677BCB823ED3F2DBF33E11FD0BE23ABB.
CYPRESS-HAR-GENERATOR 49211: The information about the target is as follows: {"targetId":"426A4FC284C64A86EBFE324497E998AB","type":"service_worker","title":"Service Worker https://xyz.xyz","url":"xyz.xyz/?cdnDomain=xyz.xyz","attached":true,"canAccessOpener":false,"browserContextId":"99A5C94DD10A5994FBEBBF67F0575AA6"}
CYPRESS-HAR-GENERATOR 49211: Attempting to connect to Chrome Debugging Protocol
CYPRESS-HAR-GENERATOR 49211: Connected to Chrome Debugging Protocol
CYPRESS-HAR-GENERATOR 49211: Session A97453BC80AFB6CEE9208E3ABFEFC326 associated with request: 50867.311
CYPRESS-HAR-GENERATOR 49211: Failed request: 50867.311. Reason: net::ERR_ABORTED

Environment

  • "cypress": "12.17.0"
  • "chrome-remote-interface": "0.32.2"
  • "@types/chrome-remote-interface": "^0.31.10"
  • "@types/har-format": "1.2.11" - Was necessary to install as otherwise the tests didn't even run with the latest cypress-har-generator update

Steps to reproduce

  • Execute cy.recordHar({content: false}) in beforeEach hook
@krikkrob krikkrob added the Type: bug Something isn't working label Jul 18, 2023
@MoKhajavi75
Copy link

MoKhajavi75 commented Aug 28, 2023

Any way to silence this warning?

@krikkrob
Copy link
Author

@MohamadKh75 Haven't found a way yet. Are you having the same issue?

@MoKhajavi75
Copy link

@MohamadKh75 Haven't found a way yet. Are you having the same issue?

yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants