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

CY:command is showing few "uncaught exceptions", how to filter them #118

Closed
dinuemani opened this issue Aug 18, 2021 · 11 comments
Closed

CY:command is showing few "uncaught exceptions", how to filter them #118

dinuemani opened this issue Aug 18, 2021 · 11 comments

Comments

@dinuemani
Copy link

we are seeing bunch of "cy:command ✔ uncaught exception TypeError: Cannot set property 'status' of undefined", errors in the terminal report. is there a way to filter them out and not show these in the report?
i tried using this, but it didnot work. any help on how to filter them please?

filterLog: ([type]) => {
if (["cy:command"].includes(uncaught exception TypeError: Cannot set property 'status' of undefined )) {
return false
}
}

@archfz
Copy link
Owner

archfz commented Aug 19, 2021

Cypress and the plugin version?
Is the error source your code or this plugin. Please check where the error is comming from browser side: from the inspector console. Are the tests actually passing?

@dinuemani
Copy link
Author

dinuemani commented Aug 19, 2021

it worked fine with cypress 6.6 and "cypress-terminal-report": "^1.4.1"
but started seeing those addittional logs from below version
"cypress": "7.6.0",
"cypress-terminal-report": "^3.3.0",

when i print warning, it showed me this

cons:warn ❖ @ngrx/store: runtime checks are currently opt-in but will be the default in the next major version with the possibility to opt-out, see https://ngrx.io/guide/migration/v8 for more information.
cy:command ✔ uncaught exception TypeError: Cannot set property 'status' of undefined

@archfz
Copy link
Owner

archfz commented Aug 19, 2021

When you run the test in the ui browser and check the inspector console don't you have a full stack trace for that error? It would really help to know the source of the error. The logs on terminal I suppose don't show the trace.

@dinuemani
Copy link
Author

i see mostly it is showing that when it is hitting "/assets/newrelic/newrelic-qa.js:1 " it is causing the error in console

/assets/newrelic/newrelic-qa.js:1 Uncaught TypeError: Cannot set property 'status' of undefined
caliper.bootstrap.js:25 [Caliper: WebComponents]
caliper.bootstrap.js:25 [Caliper: Bootstrap]
8details:9 Uncaught TypeError: Cannot set property 'status' of undefined
at a (details:9)
at XMLHttpRequest. (details:9)
at XMLHttpRequest.nrWrapper (details:9)

@archfz
Copy link
Owner

archfz commented Aug 19, 2021

That seems to be an error not from this plugin.

In any case if it's a console error it should show in cypress-terminal-report as cons:error X .. and not cy:command heavy_check_mark uncaught exception TypeError: Cannot set property 'status' of undefined. So something is strange.

Please send also a screenshot how it shows in terminal. And see if you disable the plugin in support install does it still shows this error in the browser.

@dinuemani
Copy link
Author

   cons:warn ❖  @ngrx/store: runtime checks are currently opt-in but will be the default in the next major version with the possibility to opt-out, see https://ngrx.io/guide/migration/v8 for more information.
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cons:error ✘  Error,
                Error: Request failed with status code 400
                    at e.exports (https://caliper-qa./com/static/elements/caliper.elements.min.js?0.15.92:1:602207)
                    at Soal.e.exports (https://caliper-qa./static/elements/caliper.elements.min.js?0.15.92:1:359446)
                    at XMLHttpRequest.g.onreadystatechange (https://caliper-qa/static/elements/caliper.elements.min.js?0.15.92:1:153678)
                    at XMLHttpRequest.eval [as __zone_symbol__ON_PROPERTYreadystatechange] (eval at makeContentWindowListener (https://qa/__cypress/runner/cypress_runner.js:154898:10), <anonymous>:4:29)
                    at XMLHttpRequest.wrapFn (https://qa/polyfills-es2015.js:4578:43)
                    at ZoneD ...
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined
  cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined

@csvan
Copy link

csvan commented Aug 20, 2021

Not sure if related, but after upgrading to 3.3.1 we started seeing uncaught exception TypeError: Cannot read property 'size' of null, which actually caused tests to break. Locking to version 3.3.0 resolved it.

@archfz
Copy link
Owner

archfz commented Aug 20, 2021

@csvan that is unrelated to this issue, indeed 3.3.1 introduced a critical bug. Update to 3.3.2 see #119

@archfz
Copy link
Owner

archfz commented Aug 20, 2021

@dinuemani

I have looked into the code of the plugin and there is no place where we try to set status property of any object. Also as you also stated the error is thrown in this file, which I don't know what it is: /assets/newrelic/newrelic-qa.js:1. So if in any way this plugin causes that issue that is somehow indirectly.

The really strange part that I don't yet understand is how that error message gets into the command log.

cy:command ✔  uncaught exception  TypeError: Cannot set property 'status' of undefined

Cause as you can see this is how we compose the log for this:

Cypress.on('log:added', (options) => {
     if (
        options.instrument === 'command' &&
        options.consoleProps &&
        !['xhr', 'log', 'request'].includes(options.name) &&
        !(options.name === 'task' && options.message.match(/ctrLogMessages/))
      ) {
        const log = options.name + '\t' + options.message;
        const severity = options.state === 'failed' ? CONSTANTS.SEVERITY.ERROR : '';
        this.collectorState.addLog([LOG_TYPE.CYPRESS_COMMAND, log, severity], options.id);
      }
});

What seems to be happening is that options in the above code somehow becomes that error. I guess options.name = uncaught exception; and options.message = TypeError: Cannot set property 'status' of undefined. And that part would make sense maybe somehow. But there are those checks as well like options.instrument === 'command' which for a pure error object should not be true and thus the command should not be logged.

I suspect this is either cypress internal or somehow an issue with your setup. Can you try to revert to cypress 6.6 or upgrade to newer cypress version and see if it reproduces? On the other hand you could also try keeping cypress 7.6 and reverting this plugin to like 2.x

@archfz
Copy link
Owner

archfz commented Aug 20, 2021

Actually I think I have found your issue. Seems to be some incompatibility between newrelic and cypress. Please see if this thread helps you https://discuss.newrelic.com/t/exception-in-nrwrapper/72759/21

@archfz
Copy link
Owner

archfz commented Aug 20, 2021

I am closing this for now as most things point to external issue. If you decide to ignore the error and just filter it the following should work:

{
  filterLog: ([type, message]) => message.indexOf('TypeError: Cannot set property \'status\' of undefined') == -1,
}

@archfz archfz closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants