-
Notifications
You must be signed in to change notification settings - Fork 3.3k
TypeError: Cannot read property 'replace' of undefined at stripCustomProtocol #7915
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
Comments
There's something about the file path that we're unable to read in your example. I'm not able to run the test as given - the Please provide completely runnable test code so that we can reproduce and track down where this is throwing. |
@jennifer-shehane the base URL in the cypress.json file looks like this: I edited my code above to update the cy.visit url, please take a look and let me know if I missed anything else. Any idea what the strip custom protocol error might be about? |
@jennifer-shehane I just verified the issue only happens in the pilot environment not in production, you will not be able to access our pilot environment since it operates under our vpn network so not sure how you'll be able to re-create it. Can you shed any light on why that might be happening in one environment but not in another? what is strip custom protocol? I put a bunch of x's in the password field above since I realized it was open to the general public. |
ok putting the below code at the top of my tests got things working for me again. Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
}) |
@eabusharkh0 bro you literally saved my life, I've been with the same error all day! Thanks |
Unfortunately we have to close this issue as there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. Please comment in this issue with a reproducible example and we will consider reopening the issue. |
I'm also getting this error sometimes (as in, random on any of the tests that make a cy.request call). Using Cypress 5.0.0 TypeError: Cannot read property 'replace' of undefined
Because this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `Data import`
at stripCustomProtocol (http://localhost:51599/__cypress/runner/cypress_runner.js:176381:19)
at getSourceDetailsForLine (http://localhost:51599/__cypress/runner/cypress_runner.js:176397:22)
at apply (http://localhost:51599/__cypress/runner/cypress_runner.js:24739:17)
at wrapper (http://localhost:51599/__cypress/runner/cypress_runner.js:29598:16)
at arrayMap (http://localhost:51599/__cypress/runner/cypress_runner.js:24900:23)
at Function.map (http://localhost:51599/__cypress/runner/cypress_runner.js:33841:14)
at Object.getSourceStack (http://localhost:51599/__cypress/runner/cypress_runner.js:176437:18)
at Object.enhanceStack (http://localhost:51599/__cypress/runner/cypress_runner.js:171468:43)
at fail (http://localhost:51599/__cypress/runner/cypress_runner.js:168556:21)
at http://localhost:51599/__cypress/runner/cypress_runner.js:168432:14
From previous event:
at run (http://localhost:51599/__cypress/runner/cypress_runner.js:168426:16)
at $Cy.cy.<computed> [as login] (http://localhost:51599/__cypress/runner/cypress_runner.js:168852:11)
at __stackReplacementMarker (http://localhost:51599/__cypress/runner/cypress_runner.js:167942:13)
at Context.runnable.fn (http://localhost:51599/__cypress/runner/cypress_runner.js:169078:21)
at callFn (http://localhost:51599/__cypress/runner/cypress_runner.js:103957:21)
at Hook.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://localhost:51599/__cypress/runner/cypress_runner.js:103944:7)
at http://localhost:51599/__cypress/runner/cypress_runner.js:174727:28
From previous event:
at Object.onRunnableRun (http://localhost:51599/__cypress/runner/cypress_runner.js:174715:20)
at $Cypress.action (http://localhost:51599/__cypress/runner/cypress_runner.js:165051:61)
at Hook.Runnable.run (http://localhost:51599/__cypress/runner/cypress_runner.js:173050:13)
at next (http://localhost:51599/__cypress/runner/cypress_runner.js:104459:10)
at http://localhost:51599/__cypress/runner/cypress_runner.js:104503:5
at timeslice (http://localhost:51599/__cypress/runner/cypress_runner.js:98429:27)
logError @ cypress_runner.js:199987 Would it be an idea to just validate the if originalFile is not undefined and then just putting 'unknown' for it. At least until the actual origin of the issue has been found? |
Reliably can reproduce this in branch https://github.com/cypress-io/cypress-example-todomvc/tree/problem Cypress v5.5.0 Install dependencies and run with Setting the breakpoint at the failing line first stop second stop and then it crashes |
Funnily enough, I think there is some kind of syntax error that originates first, and then is hidden by our strip custom protocol logic When in the
with
then the application started working. See https://github.com/cypress-io/cypress-example-todomvc/tree/fix-eslint |
Ok, yes, here are the screenshots. First the app does not load, so the Cypress command looking for the element fails Then "pause on caught exceptions" gives me the actual error, and this is a JSX file we include as a template, but it gets transformed at the runtime
Then we hit our error and we can see the stack - there are some anonymous lines there, and probably no filename |
The code for this is done in cypress-io/cypress#9081, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
When my automated script lands on a new page, the script fails and when I print the error to console, I get the error in the subject line.
Desired behavior:
For the test to continue on and finish successfully like it has in the past.
Test code to reproduce
Versions
Cypress version: 4.10.0, Window 10.
The text was updated successfully, but these errors were encountered: