cypress-io / cypress-io/github-action
ping emits `ERR_SOCKET_CLOSED_BEFORE_CONNECTION` immediately on Node.js >=24.20.0
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 353
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 27
Description
- follows on from https://github.com/cypress-io/github-action/issues/1869
## 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.
## Steps to reproduce
Under Node.js >=24.20.0 or Node.js >=26.7.0, with no server running, execute:
```shell
node src/ping-cli.js http://localhost:3000
```
## Logs
```console
$ node src/ping-cli.js http://localhost:3000
pinging url http://localhost:3000 for 30 seconds
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
Error [ERR_SOCKET_CLOSED_BEFORE_CONNECTION]: Socket closed before the connection was established
at Socket.onClose (node:net:1239:10)
at Socket.wrapper (node:events:639:12)
at Socket.emit (node:events:526:24)
at TCP. (node:net:362:12) {
code: 'ERR_SOCKET_CLOSED_BEFORE_CONNECTION'
}
Node.js v24.20.0
```
## Assessment
The action currently uses [got@11.8.6](https://github.com/sindresorhus/got/releases/tag/v11.8.6), released in Dec 2022, which is the latest CommonJS compatible version.
Higher versions, starting with [got@12.0.0](https://github.com/sindresorhus/got/releases/tag/v12.0.0). released in Dec 2021, are pure ESM.
[got@16.0.0](https://github.com/sindresorhus/got/releases/tag/v16.0.0), released on Aug 31, 2026, includes the fix "Retry on connection errors reported by `request.end()` instead of failing the request"
## Suggestion
Migrate
| FROM | TO |
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [got@11.8.6](https://github.com/sindresorhus/got/releases/tag/v11.8.6) CommonJS | [got@16.0.0](https://github.com/sindresorhus/got/releases/tag/v16.0.0) ESM |
- Leave the action source [index.js](https://github.com/cypress-io/github-action/blob/master/index.js) as CommonJS. See also https://github.com/cypress-io/github-action/issues/1647 as future enhancement proposal.
Contributor guide
Assessment
This issue has not been assessed yet.