-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Getting the error in CircleCI "CypressError: Cypress detected a cross origin error happened on page load" for same domain #2448
Comments
Do you have a screenshot/video of the failure? Is there anything strange being printed in the command log (the lefthand side of Cypress commands)? |
@jennifer-shehane You can find the screenshot here https://monosnap.com/file/pKBg4hQBNitQel2lbv0V6cv7tluWMU |
@jennifer-shehane, this happens to me as well 😞 Works on Chrome Version 69.0.3497.100 (Official Build) (64-bit) |
@jennifer-shehane same thing happening to me :( {
"baseUrl": "http://localhost:3002",
"defaultCommandTimeout": 10000,
"chromeWebSecurity": false
} Let me know if there is anything I can do to help debug this. |
I wonder if this is related
|
Potentially related fix going out in 3.1.2 #2787 |
Could you try to update to version 3.1.2 as we just fixed some cross origin error issues. Otherwise we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this? |
this is happening to me as well - very inconsistent. I dont believe i can provide a "reproducible example" either. its occuring on 3.1.4 for me in electron as well :( |
My guess is that trying to access properties from other frames is causing an issue. I can see the same code break in certain lines of cypress runner code - e.g. when cypress is getting window props and needs to do EDIT: @jennifer-shehane i cannot find anything which seems like the same issue I am having now. Some more details
I am using MacOS as well. |
I'm facing exactly the same error, but no idea how to reproduce it in a way I can share it here. |
Unfortunately we have to close this issue as there is not enough information to reproduce the problem. Please comment in this issue with a reproducible example and we will reopen the issue. 🙏 |
@jennifer-shehane, Hi, I have same issue, when i try to change browser's date by this example The error is
Cypress version: v3.5.2 describe("Date time",()=>{
it("should not fails",()=>{
const now = new Date(2017, 3, 14).getTime() // April 14, 2017 timestamp
// When the next line is commented out, the code works fine.
cy.clock(now)
cy.visit('/');
})
}) |
@Deemon47 I'm unable to reproduce this when calling Can you provide the url here? I think an error is being thrown somewhere from the application code (or a 3rd party dep of the app). |
I can confirm this happened to me today multiple times, but after an hour or so it simply disappeared, and I've been unable to reproduce it since. |
@jennifer-shehane , Thanks for response. Today strange things happen: After my post i wasn't touch the code, and now when I run the test again, there is no |
Strange thing, but it seems, I've managed to fix this issue for my case by just cleaning site data in "cypress Chrome". I've been working on the separate simple static server for CI (which meant to replace webpack-dev-server). So each time when I've been switching to a new server (which served from the same URL "http://localhost:3000" as webpack-dev-server) and rerun tests, I've encountered issue described here ( app.use('*', (req, res) => { res.sendFile('index.html') }) I thought the problem was in fallback implementation. |
We were seeing seemingly random, intermittent CORS errors with the same domain listed, much like the original issue here. I tried all the various solutions, nothing worked — we'd still see occasional CORS errors. Seemed like an obvious race condition having to do with our DB setup, and finally I tracked it down... In our This is probably an edge case, but figured I'd add it here in case it might be helpful to anyone, since we banged our heads against this for a long time. |
StR: - bash 1: npm run server - bash 2: npm run cypress:open - execute "cross" spec note: retry plugin seems to be the key in this usercase
StR: - bash 1: npm run server - bash 2: npm run cypress:open - execute "cross" spec note: retry plugin seems to be the key in this usercase
Not sure where the discussion should be continued. So i copy & paste the same into this issue: ok here is a small example: StR: bash 1: npm run server @jennifer-shehane maybe you have to start the test a few times using the reload button: |
I tried to avoid the usage of |
Yup... I had exactly the same scenario as yours and it took me a day to figure this out. A fix was to add an assertion after a click command that URL contains certain expected text. That fixed the issue because now cypress was waiting to complete click() command before running beforeEach for the next test. |
@Postavshik Ah, good call! |
Thank you! This helps for me) I have successfully implemented login and logout with cypress + keycloak <3 |
Because my server threw an exception that was not caught during one of my tests, causing the server to go offline before the test completed (and the test tried to reach the server again), I got this error. |
We were also running into this with a login form. We discovered that when the form was submitted, the Perhaps Cypress could improve the way this error is displayed. Reading the error and the docs, it doesn't make any sense why we would get a cross origin error when the origins are actually the same. |
Also seeing this,
Now.. I've been monkeying around with my beforeEach and added some cy.intercepts recently to deal with the problem that my cy.request() with followRedirect=false not always being honored.
|
I had the same error in GitLab CI and cypress 4.0.1. Our e2e-tests sometimes succeeded and sometimes failed in GitLab, but always succeeded when run on a developer machine. It turns out that the issue was insufficient shared memory: Monitoring the [[runners]]
# …
[runners.docker]
# …
shm_size = 536870912 Of course, 536870912 is just an example value, choose whatever you think is sensible. The important part is that you increase it from the default 16 MB. I was very surprised that insufficient |
Hello everyone, in my case the problem was as follows:
In short: the error message was misleading. It was not a "cross-origin" error. It was a redirect to a non-html page. |
I suspect @lpyfm's situation may be similar, maybe the error message was misleading too and the actual problem was something else. |
For me the problem was apparently an administrator turning on certain policies - running in electron instead of chrome worked |
Current behavior:
The current code
cy.contains('Pay for booking').click()
returns the error in CircleCI:But when I run the tests locally everything is ok. As you can see the domain is the same.
The URL from where I click the button is
http://agents.test/en/booking_details/72MRGKJ
and the destination URL ishttp://agents.test/adyen/checkout/9dc3c07d-18fc-4322-ba10-d390ff3234a7
How is Cypress defining the CORS violation? Could it be the items in Response headers or cookies?
Desired behavior:
Tests should pass.
Versions
CircleCI (The server is http://php.net/manual/en/features.commandline.webserver.php)
OS: Linux Ubuntu - 18.04
Browser: Electron 59.0.3071.115
Cypress: v3.1.0
The text was updated successfully, but these errors were encountered: