diff --git a/.changeset/@whatwg-node_node-fetch-3694-dependencies.md b/.changeset/@whatwg-node_node-fetch-3694-dependencies.md deleted file mode 100644 index 176960fa183..00000000000 --- a/.changeset/@whatwg-node_node-fetch-3694-dependencies.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@whatwg-node/node-fetch": patch ---- -dependencies updates: - - Updated dependency [`@fastify/busboy@^3.2.3` ↗︎](https://www.npmjs.com/package/@fastify/busboy/v/3.2.3) (from `^3.1.1`, in `dependencies`) diff --git a/.changeset/drain-native-https-unread-body.md b/.changeset/drain-native-https-unread-body.md deleted file mode 100644 index b58b3b2178b..00000000000 --- a/.changeset/drain-native-https-unread-body.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@whatwg-node/server': patch ---- - -Drain unread request bodies correctly when the adapter uses the platform (native undici) `Request` on Node.js HTTPS. - -`discardUnreadNodeRequestBody` previously only called `IncomingMessage#resume()`. That is enough for the `@whatwg-node/node-fetch` ponyfill and for plain `node:http`, but native undici keeps an unused `IncomingMessage` body **paused**. On `node:https` the TLS upload then stalls mid-response: `readableFlowing` stays false, buffered unread bytes remain, and keep-alive / early-response paths hang or fail Node 26 unit coverage (`discard-unread-request-body`). - -For `fetchAPI.Request === globalThis.Request` on **HTTPS** (`socket.encrypted`), `normalizeNodeRequest` wraps the socket stream in a platform `ReadableStream` (via `fetchAPI.ReadableStream`). Listeners attach on first pull; discard runs a sync drain helper (detach + `IncomingMessage#resume`) instead of `body.cancel()`, so unread TLS bytes drain without destroying keep-alive and without a runtime `node:stream` / `PassThrough` import or a floating cancel promise. Plain HTTP and ponyfill paths are unchanged (`IncomingMessage` + `resume()` only). Paths that reuse `request.body` as the response body still skip discard via the existing identity checks. diff --git a/.changeset/native-request-subclasses.md b/.changeset/native-request-subclasses.md deleted file mode 100644 index e9f2a74645b..00000000000 --- a/.changeset/native-request-subclasses.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@whatwg-node/server': patch ---- - -Pick the native Fetch API for `Request` subclasses and proxies of them, such as Next.js `NextRequest`. - -Constructor identity treated those requests as the ponyfill, so `useLimitRequestBodySize` piped a native body through `PonyfillTransformStream` and Node threw `The "transform.readable" property must be an instance of ReadableStream`. diff --git a/.changeset/readable-cancel-pending-read.md b/.changeset/readable-cancel-pending-read.md deleted file mode 100644 index 7727379c3a6..00000000000 --- a/.changeset/readable-cancel-pending-read.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@whatwg-node/node-fetch': patch ---- - -Fulfill pending `reader.read()` as `{ done: true }` when `cancel(reason)` runs, matching the WHATWG ReadableStream cancel algorithm (and native undici). - -Previously `cancel()` called `readable.destroy()` without ending the stream first, so an in-flight `read()` rejected with `ERR_STREAM_PREMATURE_CLOSE` / `Premature close` instead of settling as done. The cancel `reason` still reaches `underlyingSource.cancel(reason)`. diff --git a/benchmarks/server/package.json b/benchmarks/server/package.json index 0353c2d97b8..f598372458a 100644 --- a/benchmarks/server/package.json +++ b/benchmarks/server/package.json @@ -13,7 +13,7 @@ "test": "start-server-and-test start http://127.0.0.1:4000/ping loadtest" }, "dependencies": { - "@whatwg-node/server": "0.13.0" + "@whatwg-node/server": "0.13.1" }, "devDependencies": { "start-server-and-test": "3.0.13" diff --git a/e2e/shared-server/package.json b/e2e/shared-server/package.json index bb916d8ed36..f30e22cb527 100644 --- a/e2e/shared-server/package.json +++ b/e2e/shared-server/package.json @@ -4,6 +4,6 @@ "private": true, "dependencies": { "@whatwg-node/fetch": "0.12.1", - "@whatwg-node/server": "0.13.0" + "@whatwg-node/server": "0.13.1" } } diff --git a/packages/node-fetch/CHANGELOG.md b/packages/node-fetch/CHANGELOG.md index 95a7edd876a..d87297e33b1 100644 --- a/packages/node-fetch/CHANGELOG.md +++ b/packages/node-fetch/CHANGELOG.md @@ -1,5 +1,28 @@ # @whatwg-node/node-fetch +## 0.9.2 + +### Patch Changes + +- [#3694](https://github.com/ardatan/whatwg-node/pull/3694) + [`f927bd2`](https://github.com/ardatan/whatwg-node/commit/f927bd2cf77b2e4b5eaf62dce374c976412b7527) + Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies + updates: + - Updated dependency + [`@fastify/busboy@^3.2.3` ↗︎](https://www.npmjs.com/package/@fastify/busboy/v/3.2.3) + (from `^3.1.1`, in `dependencies`) + +- [#3715](https://github.com/ardatan/whatwg-node/pull/3715) + [`06e7013`](https://github.com/ardatan/whatwg-node/commit/06e70134287cc0b624a73b3d783a8ea9aab9ca7c) + Thanks [@ardatan](https://github.com/ardatan)! - Fulfill pending + `reader.read()` as `{ done: true }` when `cancel(reason)` runs, matching the + WHATWG ReadableStream cancel algorithm (and native undici). + + Previously `cancel()` called `readable.destroy()` without ending the stream + first, so an in-flight `read()` rejected with `ERR_STREAM_PREMATURE_CLOSE` / + `Premature close` instead of settling as done. The cancel `reason` still + reaches `underlyingSource.cancel(reason)`. + ## 0.9.1 ### Patch Changes diff --git a/packages/node-fetch/package.json b/packages/node-fetch/package.json index e6611164d11..fa5bac84614 100644 --- a/packages/node-fetch/package.json +++ b/packages/node-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@whatwg-node/node-fetch", - "version": "0.9.1", + "version": "0.9.2", "type": "module", "description": "Fetch API implementation for Node", "repository": { diff --git a/packages/server/CHANGELOG.md b/packages/server/CHANGELOG.md index 536781a87c0..77d8b7bf740 100644 --- a/packages/server/CHANGELOG.md +++ b/packages/server/CHANGELOG.md @@ -1,5 +1,44 @@ # @whatwg-node/server +## 0.13.1 + +### Patch Changes + +- [#3672](https://github.com/ardatan/whatwg-node/pull/3672) + [`978ebed`](https://github.com/ardatan/whatwg-node/commit/978ebed6e45d7ff94c56711c140d8698e009c7f6) + Thanks [@renovate](https://github.com/apps/renovate)! - Drain unread request + bodies correctly when the adapter uses the platform (native undici) `Request` + on Node.js HTTPS. + + `discardUnreadNodeRequestBody` previously only called + `IncomingMessage#resume()`. That is enough for the `@whatwg-node/node-fetch` + ponyfill and for plain `node:http`, but native undici keeps an unused + `IncomingMessage` body **paused**. On `node:https` the TLS upload then stalls + mid-response: `readableFlowing` stays false, buffered unread bytes remain, and + keep-alive / early-response paths hang or fail Node 26 unit coverage + (`discard-unread-request-body`). + + For `fetchAPI.Request === globalThis.Request` on **HTTPS** + (`socket.encrypted`), `normalizeNodeRequest` wraps the socket stream in a + platform `ReadableStream` (via `fetchAPI.ReadableStream`). Listeners attach on + first pull; discard runs a sync drain helper (detach + + `IncomingMessage#resume`) instead of `body.cancel()`, so unread TLS bytes + drain without destroying keep-alive and without a runtime `node:stream` / + `PassThrough` import or a floating cancel promise. Plain HTTP and ponyfill + paths are unchanged (`IncomingMessage` + `resume()` only). Paths that reuse + `request.body` as the response body still skip discard via the existing + identity checks. + +- [#3717](https://github.com/ardatan/whatwg-node/pull/3717) + [`02e1834`](https://github.com/ardatan/whatwg-node/commit/02e1834c9645283bee9594d1ab6d16f138c6d133) + Thanks [@ardatan](https://github.com/ardatan)! - Pick the native Fetch API for + `Request` subclasses and proxies of them, such as Next.js `NextRequest`. + + Constructor identity treated those requests as the ponyfill, so + `useLimitRequestBodySize` piped a native body through + `PonyfillTransformStream` and Node threw + `The "transform.readable" property must be an instance of ReadableStream`. + ## 0.13.0 ### Minor Changes diff --git a/packages/server/package.json b/packages/server/package.json index 587efb5c80e..c170df047a8 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@whatwg-node/server", - "version": "0.13.0", + "version": "0.13.1", "type": "module", "description": "Fetch API compliant HTTP Server adapter", "repository": {