-
Notifications
You must be signed in to change notification settings - Fork 353
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
wait-on "localhost" not resolving after upgrading Node.js 16 to 18 #634
Comments
I have the same problem since few days, but I did not change anything in my project. 10 days ago Cypress works fine on my github actions, since yesterday it stared giving error like above. I don't know what is the problem. |
In my case problem was solved by updating Node.js from 16.11 to 16.13 and cypress 9.4 to 9.7. |
I experienced this today. Changing my GitHub Actions workflow to use Node 16 (from 18) solved the problem. For Node 18, I had to use name: Demo CI
on: [push, pull_request]
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 18]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install latest Chrome
run: |
sudo apt update
sudo apt --only-upgrade install google-chrome-stable
google-chrome --version
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: xvfb-run npm test -- --watch=false
- name: Run integration tests
uses: cypress-io/github-action@v5
with:
start: npm start
install: false
wait-on: ${{ matrix.node-version == 18 && 'http://[::1]:4200' || 'http://localhost:4200' }} |
I couldn't reproduce this using .github/workflows/example-wait-on.yml and Node.js 18.
|
It's running |
Thanks for the additional information. I was able to reproduce this issue. |
Which server are you starting with |
|
There is another alternative which I previously overlooked. It is documented in README: Wait-on. Use the npm package wait-on to wait for the Angular server Execute: npm install wait-on and replace wait-on: 'http://localhost:4200' with a 60 second wait for the server using wait-on wait-on: 'npx wait-on --timeout 60000 http://localhost:4200' The npm package wait-on behaves differently to the built-in |
Thanks, for me this was the solution. I was using a custom |
Edit: The examples are now fixed, in the sense that a workaround has been implemented. See PR #803. |
It would be great to know which dev webserver you were using when you wrote that you had an error message Perhaps you could let us know? I am trying to compile a list of workarounds for this issue. |
Hey @MikeMcC399, on the project where I found this we were using GatsbyJS v5 and starting a server with |
Hi @casewalker
|
There are now generic workaround instructions posted to |
@MikeMcC399 Thank you very much for all of this relevant information and the related tickets. As far as I can tell, you have done everything that should be done to close this ticket. I have not closed it myself because I don't think I know enough context to be that judge here, and I am no longer on the project I was on when I opened this (and I'm not using Gatsby anymore either). But please feel free to close it, it seems to me like you have provided all of the relevant and necessary context to help someone who ends up here either solve their issues or know where to look outside of Cypress for persisting issues. |
Thank you for your assessment! I don't think that it is necessary to keep this issue open any more. I don't however have privileges to close other users' issues myself, since I am only an external contributor. So, I would suggest that you yourself click on the Close button. It may take a while for the Cypress.io team to catch up. |
Since Node v17.0.0, you have to use the following node option on your pipeline (for me, bitbucket pipeline does not allow ipv6 adresses)
|
Thanks for your tip! Which web server are you testing on? I'm not sure that the environment variable will solve the issue for all dev webservers. In the meantime some other workaround suggestions have been posted to wait-on with Node.js 18+
|
My project is upgrading from Node 16.14.2 to 18.12.1.
On my local machine using Chrome, going to our homepage (on port 8000) using the "localhost" name works without issue (http://localhost:8000/).
In our Github workflow, we have:
However, this
wait-on
ends up timing out, resulting in the error:This was working on Node 16 but now breaks on Node 18.
Doing some digging, I came across this discussion in the Node repository, saying that starting with Node 17, the IPv4 address "127.0.0.1" would no longer be accepted by default.
But when I changed my Github config above to use
wait-on: "http://[::1]:8000/"
instead oflocalhost
, the error went away.This leads me to believe that
wait-on
is not being "smart" about localhost.Please let me know if this is an issue on my side that I should change or if you agree this is something to be tackled on the Cypress side.
The text was updated successfully, but these errors were encountered: