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

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

Closed
magopian opened this issue Mar 15, 2019 · 11 comments · Fixed by #3867
Assignees
Labels
type: regression A bug that didn't appear until a specific Cy version release

Comments

@magopian
Copy link

magopian commented Mar 15, 2019

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

@timruhle
Copy link

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.

@jennifer-shehane jennifer-shehane added the type: regression A bug that didn't appear until a specific Cy version release label Mar 19, 2019
@jennifer-shehane
Copy link
Member

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)

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Mar 19, 2019
@evvo
Copy link

evvo commented Mar 19, 2019

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

@colinwirt
Copy link

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

@chrismelbourne
Copy link

chrismelbourne commented Mar 30, 2019

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.

@colinwirt
Copy link

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?

@chrismelbourne
Copy link

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.

@flotwig
Copy link
Contributor

flotwig commented Apr 2, 2019

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 parse-domain@2.0.0, this results in:

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

With parse-domain@2.1.0, 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)

@bahmutov
Copy link
Contributor

bahmutov commented Apr 2, 2019 via email

@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Apr 2, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 2, 2019

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.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 17, 2019

Released in 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants