cypress
cypress copied to clipboard
Huge amount of uncaught exceptions: Cannot set properties of undefined (setting 'status')
Current behavior
When doing cy.visit() I get a huge amount of uncaught exceptions

I'm catching the exceptions so the cypress tests are not affected but I don't want this exceptions to happen
Cypress.on('uncaught:exception', (err) => {
// returning false here prevents Cypress from
// failing the test
if (err.message && err.message.includes('Cannot set propert')) {
return false;
}
return true;
});
Desired behavior
No exceptions since it's a just a simple visit to a public webpage
Test code to reproduce
cy.visit('https://www.vistaprint.ca/clothing-bags/t-shirts/fruit-of-the-loom-r-ink-printed-5-ounce-heavy-cotton-hd-tm-t-shirt', { timeout: 15000 })
Cypress Version
8.7.0
Other
No response
The exceptions are coming from the code of the site you are visiting. Cypress can't do anything about this. Or does it only happen when the site is run in Cypress?
We fixed the issue with this workaround, adding this in each test suite:
beforeEach(() => {
cy.log('Blocking NewRelic scripts');
//Will block
// https://js-agent.newrelic.com/nr-spa-1208.js
cy.intercept(/\.*newrelic.*$/, (req) => {
console.log('NEW RELIC INTERCEPTED');
req.reply("console.log('Fake New Relic script loaded');");
});
cy.visitPageWithSize(url, size);
});
My god @juanpallares, this happened to be my issue exactly. I have a project that loads new relic as well. Good catch!
I have the same issue, however the exception is thrown from the inline NewRelic script that in turn loads a script matching the regex in @juanpallares answer.
What's disconcerting is that running through the identical test flow manually, in the exact browser/version Cypress is using, results in zero exceptions. The exceptions are only thrown when exercising the application via Cypress
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.
This issue has been closed due to inactivity.