fix: migrate from got@11 to got@16 - #1874
Conversation
|
Provide better messages for ping-cli.
e899c92 to
6ee3237
Compare
|
This migration was generated with assistance from GitHub Copilot / Claude Sonnet 5. I don't have much experience in migrating from CommonJS to ESM, so it would be good if you (or the Cypress.io team) could cross-check. I tested it locally for Node.js 24.19.0 & 24.20.0 with and without a running webserver from examples/nextjs. In the long term, this action should be fully migrated from CommonJS to ESM, as suggested in #1647. This is however beyond the scope required to fix issue #1869 & #1873. It is also more than I would be able to contribute. |
|
Hey @MikeMcC399, we're working on releasing Cypress 16, so may be a little slower to respond the next few days. |
I appreciate the priority you will be giving to the Cypress 16 release. This PR can tolerate some delay. The issue #1869 will only become catastrophic when the GitHub Actions runner migrates to Node.js 24.20.0 which is probably still a couple of weeks away. If that happens, and the issue is still unresolved, it may require a fast reaction to avoid extending the expected disruption. |
|
Note that on GitHub-hosted runners there is no control over which runner version is used, and which version of Node.js this contains. All runners use Node.js 24.x and they are in the process of upgrading from Node.js 24.18.0 to 24.19.0, with 24.20.0 and later versions expected at some unknown date. |
ERR_SOCKET_CLOSED_BEFORE_CONNECTIONimmediately on Node.js 24.20.0 #1873Situation
Running
node src/ping-cli.js http://localhost:3000using Node.js 24.20.0 when there is no webserver available onlocalhostshows an immediate errorERR_SOCKET_CLOSED_BEFORE_CONNECTIONinstead of waiting.Node.js 24.20.0 may be used already in a GitHub self-hosted runner, as reported in issue #1869.
Released runner versions for GitHub Actions use the following in
src/Misc/externals.sh:NODE24_VERSIONactions/runner#4665 updates to Node.js 24.20.0. Releases do not follow a fixed cadence, however a rough estimate would be that Node.js 24.20.0 may start being used in GitHub-hosted runner images in late September 2026. From that time on, the action would be exposed to the bug in
gotand would cause some workflows to fail. This is in addition to current failures on some GitHub self-hosted runners.Change
Migrate
The debug ping utility src/ping-cli.js is enhanced to provide more user-friendly messages on success / failure.
Verification
Under Node.js 24.20.0
Execute the following with no server running:
The output should be:
Then in a separate terminal, start a server and ping again:
cd examples/nextjs npm run devThe output should be:
Note
Medium Risk
Changes retry and timeout behavior on the critical “wait for server” path used in workflows; fixes Node 24 breakage but warrants verification that wait semantics still match got@11.
Overview
Upgrades the action’s HTTP wait/ping helper from got@11 to got@16 so URL polling keeps retrying under Node.js 24.20+ instead of failing immediately with
ERR_SOCKET_CLOSED_BEFORE_CONNECTIONwhen nothing is listening yet.src/ping.jsloads ESM-only got via dynamicimport()from the existing CommonJS bundle, maps retry/error handling to got@16’s options (timeout.request,retry.errorCodes,enforceRetryRules: false, customcalculateDelay), and preserves the prior “retry until overall timeout” behavior including shorter delays onECONNREFUSED.src/ping-cli.jsprints clearer success and failure messages (including timeout retry stats) for manual debugging.This affects the same
ping()path the action uses when waiting forstart/wait-onURLs before Cypress runs.Reviewed by Cursor Bugbot for commit e12e4c2. Bugbot is set up for automated code reviews on this repo. Configure here.