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

Cannot read properties of undefined (reading 'currentlyAttachedTarget') #22451

Open
koooge opened this issue Jun 22, 2022 · 15 comments
Open

Cannot read properties of undefined (reading 'currentlyAttachedTarget') #22451

koooge opened this issue Jun 22, 2022 · 15 comments
Labels
E2E Issue related to end-to-end testing pkg/server This is due to an issue in the packages/server directory Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: regression A bug that didn't appear until a specific Cy version release

Comments

@koooge
Copy link
Contributor

koooge commented Jun 22, 2022

Hi there,

Current behavior

Timed out waiting for the browser to connect. Retrying...
Cannot read properties of undefined (reading 'currentlyAttachedTarget')
TypeError: Cannot read properties of undefined (reading 'currentlyAttachedTarget')
    at Object.connectToNewSpec (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/browsers/chrome.js:431:48)
    at Object.connectToNewSpec (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/browsers/index.js:139:27)
    at /path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/open_project.js:148:47
    at tryCatcher (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromiseCtx (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:641:10)
    at _drainQueueStep (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:97:12)
    at _drainQueue (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (node:internal/timers:464:21)
    111

Desired behavior

no error

Test code to reproduce

I got this error many times with cypress run --browser chromium . The test file includes 10~20 testcases.
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 10.2.0 │
│ Browser: Chromium 101 (headless) │
│ Node Version: v16.12.0 (/usr/bin/node) │

│ Params: Tag: false, Group: false, Parallel: false

Cypress Version

10.2.0

Other

No response

@emilyrohrbough
Copy link
Member

@koooge Hi there. Thank you for logging an issue. Can you please provide a the the full logs? It would provide more detail on what you did leading up to this error. Was this happening on the first spec ran within your project? Or a 2nd or 3rd spec?

I've identified where the error has occurred but want to ensure we understand the root of the issue here.

@emilyrohrbough emilyrohrbough added browser: chrome stage: awaiting response Potential fix was proposed; awaiting response labels Jun 22, 2022
@emilyrohrbough
Copy link
Member

Actually, I have reached out to someone who is familiar with this logic and it appears this is a mistake on how we are re-launching a browser after the first spec if the browser process is corrupt. This should be a relatively straightforward fix. Thank you for reporting!

@emilyrohrbough emilyrohrbough added type: regression A bug that didn't appear until a specific Cy version release pkg/server This is due to an issue in the packages/server directory and removed browser: chrome stage: awaiting response Potential fix was proposed; awaiting response labels Jun 22, 2022
@splincode
Copy link

I have the same issue

@nsbarsukov
Copy link
Contributor

nsbarsukov commented Jun 28, 2022

@KiranChil
Copy link

KiranChil commented Jul 13, 2022

I rolled cypress back to 10.0.0 where this issue was not happening.

Noticed this issue being intermittent in 10.3.0 & 10.1.0.

@gbooth27
Copy link

any updates on when this will be fixed @emilyrohrbough ?

@gbooth27
Copy link

@emilyrohrbough looks like the latest release still has this issue, any ETA on when this fix will get out?

@sandy-farnsworth
Copy link

I also saw this issue in 10.3.1. We use sorry cypress director, and I was running 2 threads for my visual tests, and I would get this error every time when the last test tried to run. When I switched to 1 thread, the tests were fine.

@alyssaruth
Copy link

alyssaruth commented Aug 3, 2022

I also saw this issue in 10.3.1. We use sorry cypress director, and I was running 2 threads for my visual tests, and I would get this error every time when the last test tried to run. When I switched to 1 thread, the tests were fine.

We're also using the sorry cypress director and saw this when the last spec tried to run. It's not every time - I'm not totally clear on what the pattern is between builds that are affected vs ones that aren't, though.

It's just hitting our screenshot tests, so I'm going to try moving those into a dedicated runner and parallelise the rest of the suite (functional tests) like before 🤞

@alyssaruth
Copy link

Ah, there's a buggy interaction between Cypress 10 and sorry-cypress which causes the browser to get closed before the final spec runs (because the penultimate spec is reported as N of N). The root cause is really a sorry-cypress bug, raised with them here: sorry-cypress/sorry-cypress#613.

Just adding this for info in case it helps anyone. The TypeError mentioned in this issue is still a separate bug in Cypress that should be fixed 😄

@agoldis
Copy link

agoldis commented Aug 12, 2022

Sorry-cypress issue was fixed in v2.3.0, thanks @alyssa-glean for providing a solution.

The original problem of cypress runner closing the browser (or not populating currentlyAttachedTarget in browser-cri-client) is still a separate bug, though, not related to dashboard orchestration.

@anewlens
Copy link

Any update or workaround on this issue? running into this in version 10.0.0, 10.3.0 and 10.9.0. Need to stay 10.0 and above for NextJS compatibility.

@nagash77 nagash77 added E2E Issue related to end-to-end testing and removed E2E-core labels Nov 8, 2022
@qa-joerg
Copy link

qa-joerg commented Nov 9, 2022

Having the same issue on 10.0.0 < 10.3.0. This happens randomly during the test run. Please provide a fix for this issue

@dadagama
Copy link

have similar issue:

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        10.10.0                                                                        │
  │ Browser:        Chrome 85 (headless)                                                           │
  │ Node Version:   v14.19.0 (/usr/bin/node)                                                       │
  │ Specs:          2 found (*****.cy.ts, ******.cy.ts, ***** )                                    │
  │ Searched:       ./src/integration/**/*.cy.ts                                                   │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────

  Running: analytics-smoke.cy.ts                                                       (1 of 3)
Cannot read properties of undefined (reading 'h7')
TypeError: Cannot read properties of undefined (reading 'h7')
    at Reporter.safelyMergeRunnable (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/server/lib/reporter.js:174:17)
    at Reporter.parseArgs (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/server/lib/reporter.js:377:18)
    at Reporter.emit (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/server/lib/reporter.js:359:17)
    at Object.onMocha (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/server/lib/project-base.js:272:34)
    at Socket.<anonymous> (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/server/lib/socket-base.js:260:40)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at Socket.emitUntyped (/home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/jenkins/.cache/Cypress/10.10.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Using
"cypress": "^10.10.0",

in case this stack trace helps someone :)

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 31, 2023
@nagash77 nagash77 added Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed stale no activity on this issue for a long period labels Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing pkg/server This is due to an issue in the packages/server directory Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
Development

No branches or pull requests