Cypress: Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.

Created on 15 Mar 2019  Â·  11Comments  Â·  Source: cypress-io/cypress

Current behavior:

I'm writing my very first test:

describe("First test", function () {
    it("Does not do much", function () {
        cy.visit("http://dev.classea12.beta.gouv.fr")
    });
});

And the test starts running, opens the url, and then freezes with a blank page. In the console I have those error messages:

Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.
    at $Cypress.setConfig (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59917:23)
    at new $Cypress (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59908:10)
    at Function.$Cypress.create (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:60248:12)
    at Object.setup (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:171065:31)
    at Iframes._this._run (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170088:32)
    at Iframes.componentDidMount (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170209:12)
    at Iframes.f (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:135396:14)
    at commitLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:157531:22)
    at commitAllLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:158933:7)
    at HTMLUnknownElement.callCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140550:14)
    at Object.invokeGuardedCallbackDev (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140600:16)
    at invokeGuardedCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140657:31)
    at commitRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:159145:7)
    at http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160615:5
    at Object.unstable_runWithPriority (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:121479:12)
    at completeRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160614:13)
cypress_runner.js:168193 Uncaught TypeError: Cannot read property 'getSizeContainer' of undefined
    at App._handleScreenshots (cypress_runner.js:168193)
    at App.componentDidMount (cypress_runner.js:168163)
    at App.f (cypress_runner.js:135396)
    at commitLifeCycles (cypress_runner.js:157531)
    at commitAllLifeCycles (cypress_runner.js:158933)
    at HTMLUnknownElement.callCallback (cypress_runner.js:140550)
    at Object.invokeGuardedCallbackDev (cypress_runner.js:140600)
    at invokeGuardedCallback (cypress_runner.js:140657)
    at commitRoot (cypress_runner.js:159145)
    at cypress_runner.js:160615
    at Object.unstable_runWithPriority (cypress_runner.js:121479)
    at completeRoot (cypress_runner.js:160614)
    at performWorkOnRoot (cypress_runner.js:160543)
    at performWork (cypress_runner.js:160451)
    at performSyncWork (cypress_runner.js:160425)
    at batchedUpdates$1 (cypress_runner.js:160640)
cypress_runner.js:157314 The above error occurred in the <Iframes> component:
    in Iframes (created by App)
    in div (created by App)
    in div (created by App)
    in App (created by Container)
    in Container

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ cypress_runner.js:157314
cypress_runner.js:157314 The above error occurred in the <App> component:
    in App (created by Container)
    in Container

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ cypress_runner.js:157314
cypress_runner.js:160509 Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.
    at $Cypress.setConfig (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59917:23)
    at new $Cypress (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59908:10)
    at Function.$Cypress.create (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:60248:12)
    at Object.setup (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:171065:31)
    at Iframes._this._run (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170088:32)
    at Iframes.componentDidMount (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170209:12)
    at Iframes.f (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:135396:14)
    at commitLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:157531:22)
    at commitAllLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:158933:7)
    at HTMLUnknownElement.callCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140550:14)
    at Object.invokeGuardedCallbackDev (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140600:16)
    at invokeGuardedCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140657:31)
    at commitRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:159145:7)
    at http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160615:5
    at Object.unstable_runWithPriority (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:121479:12)
    at completeRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160614:13)

Desired behavior:

It works properly if I open the local website I'm developing, or https://example.cypress.io/, but not on our development website or our production website

Steps to reproduce: (app code and test code)

To reproduce, use the following test:

describe("First test", function () {
    it("Does not do much", function () {
        cy.visit("http://dev.classea12.beta.gouv.fr")
    });
});

Versions

Cypress: 3.2.0
Browser: Electron 59 (headless)
Operating system: Linux Mint 19.1 Tessa

regression

Most helpful comment

I get this same error after upgrading to v3.2.0. A blank screen with the error message Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'net.au' is a top-level domain..

@magopian You can use Cypress v3.1.5 for now, as I can confirm that it works for me.

All 11 comments

I get this same error after upgrading to v3.2.0. A blank screen with the error message Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'net.au' is a top-level domain..

@magopian You can use Cypress v3.1.5 for now, as I can confirm that it works for me.

I can recreate this with the test code above and confirm that this happens in 3.2.0 and not in 3.1.5.

Stacktrace leads here: https://github.com/cypress-io/cypress/blob/issue-3739-fix-fixtures/packages/driver/src/cypress.coffee#L104

Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.

Stacktrace:

cypress_runner.js:59917 Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.
    at $Cypress.setConfig (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59917:23)
    at new $Cypress (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59908:10)
    at Function.$Cypress.create (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:60248:12)
    at Object.setup (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:171065:31)
    at Iframes._this._run (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170088:32)
    at Iframes.componentDidMount (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170209:12)
    at Iframes.f (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:135396:14)
    at commitLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:157531:22)
    at commitAllLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:158933:7)
    at HTMLUnknownElement.callCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140550:14)
    at Object.invokeGuardedCallbackDev (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140600:16)
    at invokeGuardedCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140657:31)
    at commitRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:159145:7)
    at http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160615:5
    at Object.unstable_runWithPriority (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:121479:12)
    at completeRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160614:13)
cypress_runner.js:168193 Uncaught TypeError: Cannot read property 'getSizeContainer' of undefined
    at App._handleScreenshots (cypress_runner.js:168193)
    at App.componentDidMount (cypress_runner.js:168163)
    at App.f (cypress_runner.js:135396)
    at commitLifeCycles (cypress_runner.js:157531)
    at commitAllLifeCycles (cypress_runner.js:158933)
    at HTMLUnknownElement.callCallback (cypress_runner.js:140550)
    at Object.invokeGuardedCallbackDev (cypress_runner.js:140600)
    at invokeGuardedCallback (cypress_runner.js:140657)
    at commitRoot (cypress_runner.js:159145)
    at cypress_runner.js:160615
    at Object.unstable_runWithPriority (cypress_runner.js:121479)
    at completeRoot (cypress_runner.js:160614)
    at performWorkOnRoot (cypress_runner.js:160543)
    at performWork (cypress_runner.js:160451)
    at performSyncWork (cypress_runner.js:160425)
    at batchedUpdates$1 (cypress_runner.js:160640)
cypress_runner.js:157314 The above error occurred in the <Iframes> component:
    in Iframes (created by App)
    in div (created by App)
    in div (created by App)
    in App (created by Container)
    in Container

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ cypress_runner.js:157314
cypress_runner.js:157314 The above error occurred in the <App> component:
    in App (created by Container)
    in Container

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ cypress_runner.js:157314
cypress_runner.js:160509 Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'gouv.fr' is a top-level domain.
    at $Cypress.setConfig (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59917:23)
    at new $Cypress (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:59908:10)
    at Function.$Cypress.create (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:60248:12)
    at Object.setup (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:171065:31)
    at Iframes._this._run (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170088:32)
    at Iframes.componentDidMount (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:170209:12)
    at Iframes.f (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:135396:14)
    at commitLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:157531:22)
    at commitAllLifeCycles (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:158933:7)
    at HTMLUnknownElement.callCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140550:14)
    at Object.invokeGuardedCallbackDev (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140600:16)
    at invokeGuardedCallback (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:140657:31)
    at commitRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:159145:7)
    at http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160615:5
    at Object.unstable_runWithPriority (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:121479:12)
    at completeRoot (http://dev.classea12.beta.gouv.fr/__cypress/runner/cypress_runner.js:160614:13)

The issue also affects URLs with .co.uk domains:
Failed to set the 'domain' property on 'Document': 'co.uk' is a top-level domain.

Also affecting Magento Commerce Cloud environments at ...magentosite.cloud

Also having this issue with 'com.sg' domains:

Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'com.sg' is a top-level domain.

This problem only started with 3.2.0 update and is a showstopper as nothing can be tested.

This problem only started with 3.2.0 update and is a showstopper as nothing can be tested.

For now you'll have to revert back to 3.1.5 if possible -- I found it works OK for my projects, does 3.1.5 work for you?

This problem only started with 3.2.0 update and is a showstopper as nothing can be tested.

For now you'll have to revert back to 3.1.5 if possible -- I found it works OK for my projects, does 3.1.5 work for you?

@colinwirt Yup I reverted and it works fine, as far as this bug goes. Thanks.

This appears to be related to an update in the parse-domain dependency: #3437

I've tracked it down to be some change that happened when parse-domain went from 2.0.0 to 2.1.0. It seems that parse-domain has stopped correctly handling certain public suffixes.

const parseDomain = require('parse-domain')

console.log(
  parseDomain('dev.classea12.beta.gouv.fr', {
    privateTlds: true,
    customTlds: /^[\d\.]+$/
  })
)

With [email protected], this results in:

{ tld: 'gouv.fr', domain: 'beta', subdomain: 'dev.classea12' }

With [email protected], this results in:

{ tld: 'fr', domain: 'gouv', subdomain: 'dev.classea12.beta' }

Seems like something broke in parse-domain's handling of the public suffix list. I've opened an issue on their end (peerigon/parse-domain#67) and I will revert the dependency to 2.0.0 for now. I think there is an open PR on their end that will fix it (peerigon/parse-domain#65)

Great, also add a unit test to make sure going forward the domain Parsing is going to stay correct

Sent from my iPhone

On Apr 2, 2019, at 14:31, Zach Bloomquist notifications@github.com wrote:

This appears to be related to an update in the parse-domain dependency: #3437

I've tracked it down to be some change that happened when parse-domain went from 2.0.0 to 2.1.0. It seems that parse-domain has stopped correctly handling certain public suffixes.

const parseDomain = require('parse-domain')

console.log(
parseDomain('dev.classea12.beta.gouv.fr', {
privateTlds: true,
customTlds: /^[d.]+$/
})
)
With [email protected], this results in:

{ tld: 'gouv.fr', domain: 'beta', subdomain: 'dev.classea12' }
With [email protected], this results in:

{ tld: 'fr', domain: 'gouv', subdomain: 'dev.classea12.beta' }
Seems like something broke in parse-domain's handling of the public suffix list. I've opened an issue on their end (peerigon/parse-domain#67) and I will revert the dependency to 2.0.0 for now.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

The code for this is done in cypress-io/cypress#3867, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Released in 3.3.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbung picture rbung  Â·  3Comments

carloscheddar picture carloscheddar  Â·  3Comments

SecondFlight picture SecondFlight  Â·  3Comments

szabyg picture szabyg  Â·  3Comments

brian-mann picture brian-mann  Â·  3Comments