question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cy.origin throws Uncaught error & breaks in v10.9.0+

See original GitHub issue

Current behavior

Our application redirects on load to an Auth0 login page and signs in the user. We updated from v10.7.0 to v10.10.0 and immediately ran into failing origin usage with the below stacktrace:

Uncaught Error: on only accepts instances of Function
    at ../driver/node_modules/eventemitter2/lib/eventemitter2.js.EventEmitter._on (xml.js:30:2)
    at ../driver/node_modules/eventemitter2/lib/eventemitter2.js.EventEmitter.on (xml.js:30:2)
    at attachToWindow (xml.js:30:2)
    at SpecBridgeCommunicator.<anonymous> (xml.js:30:2)
    at SpecBridgeCommunicator.emit (xml.js:30:2)
    at SpecBridgeCommunicator.onMessage (xml.js:30:2)
    at xml.js:30:2

image

This error appears to stop the login from working properly, as it fails to find the password field despite it being readily available on the DOM:

image image

Desired behavior

cy.origin works successfully.

Test code to reproduce

I’m working on a reproduction, but I’ve discovered that the login works fine whilst running on localhost and only breaks when pointed at our cloud environment. The code being used is very simple & worked on previous versions:

      cy.origin(Cypress.env('AUTH0_DOMAIN'), { args }, ({ email, password }) => {
        cy.get('#username').type(email);
        cy.get('button')
          .contains(/^Continue$/)
          .click();
        cy.get('#password').type(password);
        cy.get('button').contains('Continue').click();      
      });

There’s also another user running this problem here: https://github.com/cypress-io/cypress/issues/21201#issuecomment-1277427102

Cypress Version

10.10.0

Node version

v16.17.0

Operating System

Windows 11 22H2

Debug Logs

No response

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Hawxycommented, Nov 2, 2022

@mschile I’ve been able to reproduce this against auth0’s lab environment which uses a custom domain. Updating to 10.11.0 fixed the error being thrown (maybe it’s being caught internally?) but the origin is still not working:

https://github.com/Hawxy/auth0-cypress-reproduction

npm i & npx cypress open.

1reaction
mschilecommented, Nov 2, 2022

@Hawxy, thanks a lot for taking the time to create a reproduction! I’m hoping to get some time today to take a look at it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - Cypress Documentation
Testing multiple origins in a single test with the new cy.origin() command. ... Cypress now throws an error if any Cypress commands are...
Read more >
cypress.origin throws error: (uncaught exception)Error: on only ...
The error message suggests the problem is in the app, but that might be a red herring. Try just adding a fixed string...
Read more >
rouch/Cypress: Fast, easy and reliable testing for anything that runs ...
Cypress - Fast, easy and reliable testing for anything that runs in a browser.
Read more >
cypress - Awesome JS
v10.9.0. local_offer v10.9.0. cloud_download SBOM.rpt. 769.31KB ... sometimes throw an expected error on navigation with cy.back() and cy.go() .
Read more >
Pixelmon Patch Notes
1 Minecraft 1.16.5. 1.1 Version 9 · 2 Minecraft 1.12.2. 2.1 Version 8; 2.2 Version 7; 2.3 Version 6 · 3 Minecraft 1.10.2....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found