quasar-testing: Quasar, Vite, Cypress out-the-box config hanging on Node 18
Software version
OS: Macos / Windows 10 Node: 18.2.0 NPM: 8.10.0 Any other software related to your bug:
What did you get as the error?
running the generated script test:e2e or test:e2e:ci causes a hang. Upon adding the debug environment variable for start-test it is getting a connection refused on ::1
What were you expecting?
Cypress to start
What steps did you take, to get the error?
- Install quasar via
yarn create quasarchoosingvite. - Add the quasar testing extension choosing cypress.
- run
yarn test:e2eoryarn test:e2e:ci
Current fix / workaround
It appears the generated scripts in package.json tell start-test to listen for http-get://localhost:9000 which is resolving to ::1 at runtime. This is not listened on by quasar dev out-the-box.
The current fix is to change the script to listen for http-get://127.0.0.1:9000 to force ipv4 or to change the listen address for the dev server.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 15 (8 by maintainers)
Commits related to this issue
- fix(cypress): use replace localhost with 127.0.0.1 in scripts to support Node 18, closes #236 — committed to quasarframework/quasar-testing by IlCallo 6 months ago
- fix(cypress): use replace localhost with 127.0.0.1 in scripts to support Node 18, closes #236 — committed to n05la3/quasar-testing by IlCallo 6 months ago
As expected, took me quite a while to properly understand issue root and test the fix I just tagged Cypress AE v5.2 with the fix, which will of course only apply to newly generated projects
If you’re curious about the backstory, check these links out: https://github.com/quasarframework/quasar-testing/commit/8552ba37abf309d8e230eb150b596ae5b2d28cbb#diff-0df604707cf8f7ef7a25247848b4f8ef0383458d0138fb6e50af9f8d17554079R84-R95
TL;DR: Node 18 did a mess with
localhostresolution mechanism, thus the need to use127.0.0.1, Node 20 implemented “Happy Eyeballs” protocol which should make everything work as it was before We’ll revert to usinglocalhostwhen Node 18 won’t be maintained anymoreThank you for your patience 😁
This seems to be the culprit: https://github.com/nodejs/node/issues/47785
Node <18 resolved localhost to 127.0.0.1, while Node >= 18 (on Mac for sure, and on Windows for Node 18 for sure) resolve to its IPv6 counterpart ::1
I’m pretty sure there was a reason why I didn’t go with
127.0.0.1in the first place, but I’m not sure which was it I think browsers or os have some special handling forlocalhostkeyword which bypass some security checks I’ll explore that option again in the future