Cypress Crash: Uncaught TypeError: Cannot read properties of undefined (reading 'emit')
See original GitHub issueCurrent behavior
Upon finishing running my Cypress script, Cypress would crash (On Chrome Latest)
In dev tools we can see the following error:
cypress_runner.js:191727 Uncaught TypeError: Cannot read properties of undefined (reading 'emit')
at Socket.<anonymous> (cypress_runner.js:191727)
at Socket.../../node_modules/component-emitter/index.js.Emitter.emit (cypress_runner.js:18455)
at Socket.emit (cypress_runner.js:199652)
at Socket.emitEvent (cypress_runner.js:199401)
at Socket.onevent (cypress_runner.js:199388)
at Socket.onpacket (cypress_runner.js:199352)
at Manager.../../node_modules/component-emitter/index.js.Emitter.emit (cypress_runner.js:18455)
at Manager.emitReserved (cypress_runner.js:199665)
at Manager.ondecoded (cypress_runner.js:198944)
at Decoder.../../node_modules/component-emitter/index.js.Emitter.emit (cypress_runner.js:18455)
at Decoder.add (cypress_runner.js:199978)
at Manager.ondata (cypress_runner.js:198936)
at Socket.../../node_modules/component-emitter/index.js.Emitter.emit (cypress_runner.js:18455)
at Socket.onPacket (cypress_runner.js:196867)
at WS.<anonymous> (cypress_runner.js:196676)
at WS.../../node_modules/component-emitter/index.js.Emitter.emit (cypress_runner.js:18455)
Clicking on the .js line:
lodash__WEBPACK_IMPORTED_MODULE_0___default.a.each(socketToDriverEvents, event => {
ws.on(event, (...args) => {
Cypress.emit(event, ...args);
});
});
Desired behavior
No response
Test code to reproduce
Issue seems to happen on screen redirection, not sure if its due to when a session becomes invalid. If anyone can explain what the above is related to I can investigate more before providing sample code.
Cypress Version
9.1.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:25
- Comments:33 (2 by maintainers)
Top Results From Across the Web
Cypress TypeError: Cannot read properties of undefined ...
js`, but it threw an error. TypeError: Cannot read properties of undefined (reading 'uid') at Object. statSync (C:\Windows\SysWOW64\config\ ...
Read more >Error Messages | Cypress Documentation
We found an error preparing your test file. This message means that Cypress encountered an error when compiling and/or bundling your test file....
Read more >history.js:47 uncaught typeerror: cannot read properties of ...
The solution to TypeError: Cannot read properties of undefined Always conditionally check for the variable that is undefined before accessing the value. The ......
Read more >cypress-io/cypress - Gitter
Uncaught DOMException: Failed to read the 'contentDocument' property from ... /57358163/typeerror-cannot-read-property-click-of-undefined-cypress/57370009.
Read more >TypeError: Cannot read property '$emit' of undefined - Laracasts
I want to call to a method in my parent component within my child component. so I used an event for that. but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm this issue existed. On my side, this is all about Cypress Component Testing.
And I think I found some clues of the bug. This bug will only happen if you install any Cypress version large than v.8.1.0 (i.e. v.8.1.0 is safe)
The issue is reproducible, and it’s easy to do:
npx cypress open-ct
cc @bahmutov
Thx for reading. And hope this bug can be fixed.
Issues still exists in Cypress 9.6, Im hoping fix comes in Cypress 10, how can we get a Cypress dev on this?