cypress-io / cypress

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

Parallel Cypress invocation on same machine: Error: Could not find url target in browser about:blank. #29639

Open jennifer-shehane opened 3 weeks ago

jennifer-shehane commented 3 weeks ago

Current behavior

A user reported an issue where a spec will timeout unable to connect to the browser (Chrome 125). See internal thread

Snippet of some of the DEBUG logs

2024-06-06T17:22:53.293Z cypress:launcher:browsers chrome stderr: [10142:10185:0606/172253.292497:ERROR:cert_verify_proc_builtin.cc(1051)] CertVerifyProcBuiltin for safebrowsingohttpgateway.googleapis.com failed:
----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=safebrowsingohttpgateway.googleapis.com) -----
ERROR: No matching issuer found

[10142:10187:0606/172253.293129:ERROR:cert_verify_proc_builtin.cc(1051)] CertVerifyProcBuiltin for clientservices.googleapis.com failed:
----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=clientservices.googleapis.com) -----
ERROR: No matching issuer found
2024-06-06T17:22:53.297Z cypress:launcher:browsers chrome stderr: [10142:10185:0606/172253.297140:ERROR:cert_verify_proc_builtin.cc(1051)] CertVerifyProcBuiltin for accounts.google.com failed:
----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=accounts.google.com) -----
ERROR: No matching issuer found

.........more logs

2024-06-06T17:23:41.551Z cypress:server:browsers:browser-cri-client Attaching to target url about:blank
2024-06-06T17:23:41.560Z cypress:server:browsers:browser-cri-client error finding browser target, maybe retrying { delay: 1000, err: Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}] at <embedded>:4407:101579 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async n (<embedded>:4407:100726) at async Object.open (<embedded>:4413:52874) at async Object.open (<embedded>:4413:27445) at async v.relaunchBrowser (<embedded>:4498:37899) }
2024-06-06T17:23:42.561Z cypress:server:browsers:browser-cri-client Attaching to target url about:blank
2024-06-06T17:23:42.562Z cypress:server:browsers:browser-cri-client error finding browser target, maybe retrying { delay: 1000, err: Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}] at <embedded>:4407:101579 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async n (<embedded>:4407:100726) at async Object.open (<embedded>:4413:52874) at async Object.open (<embedded>:4413:27445) at async v.relaunchBrowser (<embedded>:4498:37899) }
2024-06-06T17:23:43.563Z cypress:server:browsers:browser-cri-client Attaching to target url about:blank
2024-06-06T17:23:43.564Z cypress:server:browsers:browser-cri-client error finding browser target, maybe retrying { delay: undefined, err: Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}] at <embedded>:4407:101579 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async n (<embedded>:4407:100726) at async Object.open (<embedded>:4413:52874) at async Object.open (<embedded>:4413:27445) at async v.relaunchBrowser (<embedded>:4498:37899) }
2024-06-06T17:23:43.564Z cypress:server:browsers:browser-cri-client failed to connect to CDP { err: Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}] at <embedded>:4407:101579 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async n (<embedded>:4407:100726) at async Object.open (<embedded>:4413:52874) at async Object.open (<embedded>:4413:27445) at async v.relaunchBrowser (<embedded>:4498:37899) }
2024-06-06T17:23:43.566Z cypress:server:cypress exiting with err Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}]
    at <embedded>:4407:101579
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async n (<embedded>:4407:100726)
    at async Object.open (<embedded>:4413:52874)
    at async Object.open (<embedded>:4413:27445)
    at async v.relaunchBrowser (<embedded>:4498:37899) {
  isCypressErr: true,
  type: 'CDP_COULD_NOT_CONNECT',
  details: 'Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}]\n' +
    '    at <embedded>:4407:101579\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async n (<embedded>:4407:100726)\n' +
    '    at async Object.open (<embedded>:4413:52874)\n' +
    '    at async Object.open (<embedded>:4413:27445)\n' +
    '    at async v.relaunchBrowser (<embedded>:4498:37899)',
  messageMarkdown: 'Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.\n' +
    '\n' +
    'This usually indicates there was a problem opening the Chrome browser.\n' +
    '\n' +
    'The CDP port requested was `34111`.',
  originalError: Error: Could not find url target in browser about:blank. Targets were [{"targetId":"CE16AA59A54CD27A5E7B4B2EE4EC2BD7","type":"page","title":"sdk-tests-on-pr","url":"https://***removed***/__/#/specs/runner?file=cypress/e2e/view.cy.js","attached":true,"canAccessOpener":false,"browserContextId":"F902D26D751C8BCF6C14D77D303879B9"}]
      at <embedded>:4407:101579
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async n (<embedded>:4407:100726)
      at async Object.open (<embedded>:4413:52874)
      at async Object.open (<embedded>:4413:27445)
      at async v.relaunchBrowser (<embedded>:4498:37899),
  stackWithoutMessage: '    at <embedded>:4407:101579\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async n (<embedded>:4407:100726)\n' +
    '    at async Object.open (<embedded>:4413:52874)\n' +
    '    at async Object.open (<embedded>:4413:27445)\n' +
    '    at async v.relaunchBrowser (<embedded>:4498:37899)'
}
2024-06-06T17:23:43.567Z cypress:server:cypress calling exit 1
2024-06-06T17:23:43.567Z cypress:server:cypress about to exit with code 1
2024-06-06T17:23:43.570Z cypress:server:browsers browsers.kill called with no active instance
2024-06-06T17:23:43.570Z cypress:proxy:http:util:prerequests metrics: { browserPreRequestsReceived: 0, proxyRequestsReceived: 13, immediatelyMatchedRequests: 0, unmatchedRequests: 13, unmatchedPreRequests: 0 }
2024-06-06T17:23:43.691Z cypress:cli child event fired { event: 'exit', code: 1, signal: null }
2024-06-06T17:23:43.691Z cypress:cli Stopping Xvfb

Desired behavior

Cypress should connect to new tab successfully on a new spec run.

Test code to reproduce

..

Cypress Version

13.11.0

Node version

20.14.0

Operating System

Linux

Debug Logs

No response

Other

No response

jennifer-shehane commented 1 week ago

Looking further into this error with more debug logs, this situation can happen when running Cypress in parallel executions on the same machine. Cypress is not architected in a way that expects it to run in parallel on a single machine. There are other issues regarded how each run can act in unexpected ways such as https://github.com/cypress-io/cypress/issues/26211 and https://github.com/cypress-io/cypress/issues/25470

If you encounter this error, we suggest running Cypress in parallel, with no more than a single cypress instance running per machine that it's parallelized across.