Skip to content

Commit

Permalink
fix: switch to undici for requests to fix stream close errors (#666)
Browse files Browse the repository at this point in the history
When updating WPT resources, the `wpt` command would sometimes
throw a `ERR_STREAM_PREMATURE_CLOSE` error. Switching to `undici`
fixes this issue.

The `undici` `fetch` function is only supported on Node.js 16.8+.

BREAKING CHANGE: Node.js 14.x is no longer supported.
  • Loading branch information
austinkelleher authored Feb 22, 2023
1 parent 267dde0 commit f759e7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 19.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';

import fetch from 'node-fetch';
import { fetch } from 'undici';

import { CI_DOMAIN } from './ci/ci_type_parser.js';
import proxy from './proxy.js';
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "2.1.3",
"description": "Utilities for Node.js core collaborators",
"type": "module",
"engines": {
"node": ">=16.8.0"
},
"bin": {
"get-metadata": "./bin/get-metadata.js",
"git-node": "./bin/git-node.js",
Expand Down Expand Up @@ -46,11 +49,11 @@
"listr2": "^4.0.5",
"lodash": "^4.17.21",
"log-symbols": "^5.1.0",
"node-fetch": "^3.2.4",
"ora": "^6.1.0",
"proxy-agent": "^5.0.0",
"replace-in-file": "^6.3.2",
"rimraf": "^3.0.2",
"undici": "^5.20.0",
"which": "^2.0.2",
"yargs": "^17.5.0"
},
Expand Down

0 comments on commit f759e7a

Please sign in to comment.