-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Verification of baseUrl is failing when using hosts
in cypress.json
#20647
Comments
Hi 👋🏼 @jennifer-shehane, @chrisbreiding, can anyone take a look at this issue? This We have developed a workaround to bypass the initial checks but it would be great to get this issue fixed. workaroundcypress.json
support/index.js
Thank you so much in advance. |
Hi! We need So this is also critical for us and we can not use the workaround. |
This is apparently a side-effect of how #383 was originally implemented: https://github.com/cypress-io/cypress/blame/547b700331c251410a1d17872d2a19c2009dec42/packages/server/lib/server-e2e.ts#L103-L125 Perhaps instead of just If/when #22676 is implemented, this should be kept in mind as well. |
@funktionalsystems you are right, we should keep it However, this case is a bit special because we want the check to be performed. The issue here is that the Additionally, it only happens for Linux environments, so it shouldn't be because of the piece of code you attached. |
@dani8art I agree that fixing hosts resolution is a much better solution that disabling the check. cypress/support/e2e.js:
|
@dani8art I am also on Linux (only) - I don't have a good way to test other platforms, but very odd if it doesn't happen elsewhere. It seems like it HAS to be that chunk of code - That's the only place that emits CANNOT_CONNECT_BASE_URL ("Cypress could not verify that this server is running") DNS overrides appear to be correctly checked by getAddress in packages/network/lib/connect.ts (last touched by !3531)
And DNS overrides appear to be correctly set by createHosts in packages/server/lib/server-base.ts And in general the DNS overrides appear to work correctly later on in the tests, as long as we don't get stopped by the baseUrl bug. So there must be some kind of runtime scope/timing issue where it's not getting set before being used, even though it looks "ok" lexically. I'm no JS/TS expert, but is this some async/await/promises/Bluebird shenanigans?
Again, I'm not expert, but that last part (last touched by !14479) looks especially suspect to me. |
Actually, it looks like dns is resolving Here's (sanitized) what I get when running with
The |
Wow, @funktionalsystems this is really great research, Since I saw that it was working depending on the OS I thought it might be related to "be some kind of runtime scope/timing issue". However, I can see this line
Which is always pointing to 127.0.0.1 instead of being pointing to |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Do not close, issue still exists. |
Got to love when bots mark issues as stale. "We haven't fixed this, I know, hide it!" |
Hi everyone, unfortunately, the |
Current behavior
Having a
cypress.json
like followingWhen running cypress we get an unexpected behavior, Cypress fails to verify the URL.
However if we remove
baseUrl
from thecypress.json
and we usecy.visit('http://wordpress.local/');
instead ofcy.visit('/');
it work perfect.Desired behavior
We are using a Linux base container like
cypress/included:9.4.1
in our CI system so the error happens. However, it doesn't happen locally using MacOS. You can see the following logsThe desired behavior is this working on a Linux system. The problem seems to be related to the verification of the
baseUrl
that is performed when it is found in thecypress.jso
.Test code to reproduce
Cypress.json
spec.js
Cypress Version
9.4.1
Other
The text was updated successfully, but these errors were encountered: