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 core wait-for-server behavior used before Cypress runs; incorrect retry semantics could cause flaky CI or longer hangs, though the change targets a known Node 24 + got@11 regression.
Overview
Fixes premature failure when waiting for a dev server on Node.js 24.20+ (e.g.
ERR_SOCKET_CLOSED_BEFORE_CONNECTION) by upgradinggotfrom 11.x to 16.0.0 and adapting the wait/ping helper insrc/ping.js.Because got@16 is ESM-only, the action loads it via dynamic
import()from the existing CommonJS bundle. Retry logic is updated to got@16’s API (timeout.request,retry.errorCodes,enforceRetryRules: false, andcalculateDelay) so the action still retries for the full configured wait instead of bailing immediately.src/ping-cli.jsnow prints clearer success and failure messages (including timeout/retry details on failure) for local debugging.Reviewed by Cursor Bugbot for commit 1e47cb4. Bugbot is set up for automated code reviews on this repo. Configure here.