cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

Error attaching to target cri p [Error]: 'Network.enable' wasn't found #29876

Open ThibautMarechal opened 2 months ago

ThibautMarechal commented 2 months ago

Current behavior

when calling addModule to an AudioContext, the promise never resolve or reject.

const ctx = new AudioContext()
ctx.audioWorklet.addModule('./audio-worklet-module.js') // <-- This never resolve or rejct

Desired behavior

The promise settle

Test code to reproduce

Here is a very minimalist repo that demonstrate the bug : https://github.com/ThibautMarechal/cypress-audio-context-bug

Cypress Version

13.13.1

Node version

20.12.1

Operating System

Windows

Debug Logs

The logs are too big for the issue in github so I commited them in the repro here : https://github.com/ThibautMarechal/cypress-audio-context-bug/blob/master/test.log

But found an error that might be the one :

2024-07-17T09:26:31.760Z cypress:server:browsers:cri-client error attaching to target cri p [Error]: 'Network.enable' wasn't found
    at <embedded>:633:577907
    at _._handleMessage (<embedded>:633:580210)
    at A.<anonymous> (<embedded>:633:579849)
    at A.emit (node:events:514:28)
    at f.U (<embedded>:633:565033)
    at f.emit (node:events:514:28)
    at f.dataMessage (<embedded>:633:545408)
    at f.getData (<embedded>:633:544590)
    at f.startLoop (<embedded>:633:541297)
    at f._write (<embedded>:633:540652)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at f.write (node:internal/streams/writable:337:10)
    at Socket.W (<embedded>:633:565719)
    at Socket.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  request: {
    method: 'Network.enable',
    params: {
      maxTotalBufferSize: 0,
      maxResourceBufferSize: 0,
      maxPostDataSize: 0
    },
    sessionId: 'DA1675F256704B15664A6BC47E52C96F'
  },
  response: { code: -32601, message: "'Network.enable' wasn't found" }
}

Other

It was working with the version 13.3.2 of Cypress and start failing at the version 13.3.3

ThibautMarechal commented 1 month ago

After some digging, it seems related to that change : https://github.com/cypress-io/cypress/pull/28105/files#diff-b5b66d85423fa714add2e866448d3411b0f1cdf2cb4b4a95aa80394fa3edd1b3R202

Honestly I'm a bit lost on how I can apply a fix for this, without a good knowledge on how everything is working in there 😅