Skip to content

fix: migrate from got@11 to got@16 - #1874

Open
MikeMcC399 wants to merge 6 commits into
cypress-io:masterfrom
MikeMcC399:migrate/got-to-16
Open

fix: migrate from got@11 to got@16#1874
MikeMcC399 wants to merge 6 commits into
cypress-io:masterfrom
MikeMcC399:migrate/got-to-16

Conversation

@MikeMcC399

@MikeMcC399 MikeMcC399 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Situation

Running node src/ping-cli.js http://localhost:3000 using Node.js 24.20.0 when there is no webserver available on localhost shows an immediate error ERR_SOCKET_CLOSED_BEFORE_CONNECTION instead 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:

Runner release NODE24_VERSION Released
v2.337.0 24.19.0 2026-08-26
v2.336.0 24.18.0 2026-07-20

Note: Actions Runner follows a progressive release policy, so the latest release might not be available to your enterprise, organization, or repository yet. To confirm which version of the Actions Runner you should expect, please view the download instructions for your enterprise, organization, or repository.

actions/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 got and would cause some workflows to fail. This is in addition to current failures on some GitHub self-hosted runners.

Change

Migrate

FROM TO
got@11.8.6 CommonJS got@16.0.0 ESM

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:

node src/ping-cli.js http://localhost:3000

The output should be:

$ node src/ping-cli.js http://localhost:3000
pinging url http://localhost:3000 for 30 seconds
http://localhost:3000 timed out after 61 retries, elapsed 60253ms, limit 60000ms
Could not connect to http://localhost:3000: connect ECONNREFUSED 127.0.0.1:3000

Then in a separate terminal, start a server and ping again:

cd examples/nextjs
npm run dev

The output should be:

$ node src/ping-cli.js http://localhost:3000
pinging url http://localhost:3000 for 30 seconds
http://localhost:3000 is responding

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 upgrading got from 11.x to 16.0.0 and adapting the wait/ping helper in src/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, and calculateDelay) so the action still retries for the full configured wait instead of bailing immediately.

src/ping-cli.js now 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.

@MikeMcC399 MikeMcC399 self-assigned this Aug 31, 2026
@cypress-app-bot

Copy link
Copy Markdown
Collaborator

@MikeMcC399 MikeMcC399 added bug Something isn't working topic: waiting labels Aug 31, 2026
Provide better messages for ping-cli.
@MikeMcC399

Copy link
Copy Markdown
Collaborator Author

@mschile

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.

@jennifer-shehane

Copy link
Copy Markdown
Member

Hey @MikeMcC399, we're working on releasing Cypress 16, so may be a little slower to respond the next few days.

@MikeMcC399

Copy link
Copy Markdown
Collaborator Author

Hi @jennifer-shehane

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.

@MikeMcC399

Copy link
Copy Markdown
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working topic: waiting

Projects

None yet

3 participants