[miniflare/wrangler] Bump undici to v7.24.8 and remove pnpm patch#13450
[miniflare/wrangler] Bump undici to v7.24.8 and remove pnpm patch#13450jamesopstad merged 11 commits intomainfrom
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 5b3c9f0 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The new test correctly uses Let me review the overall changes once more:
This is a clean, well-structured PR. The dependency bump is correct, the patch removal is justified, the lockfile changes are consistent, the test is well-written and follows existing patterns, and the changeset is appropriate. LGTM |
|
✅ All changesets look good |
259ccc4 to
3754fb9
Compare
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
58241c1 to
180930e
Compare
180930e to
be99cfc
Compare
Update undici from 7.24.4 to 7.24.8 which includes the upstream fix for isTraversableNavigable() that caused POST/PUT requests with non-2xx responses to throw 'fetch failed'. Remove the now-unnecessary pnpm patch. Add test covering POST/PUT with various non-2xx status codes to prevent regression. Fixes #13013 Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
undici 7.24.8 no longer considers these overrides as type errors, so the @ts-expect-error directives are now unused and cause TS2578. Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
Use structural types for keys/delimitedPrefixes helpers instead of R2Objects from @cloudflare/workers-types to avoid SpecIterableIterator incompatibility between undici 7.24.8's Headers and workers-types' Headers. Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
Convert @remix-run/node-fetch-server Headers to a plain Record<string, string> to avoid SpecIterableIterator type mismatch between undici 7.24.8 and the remix Headers implementation. Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
The test expects headers passed to dispatchFetch to be a Headers instance. Instead of converting to Record<string, string>, construct a new undici Headers object from the remix Headers to satisfy both the type system and the instanceof check. Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
The vite-plugin package doesn't have undici as a dependency. Import Headers from miniflare which re-exports it. Co-Authored-By: pbacondarwin <pete@bacondarwin.com>
…ing createHeaders Replace @remix-run/node-fetch-server's createHeaders() with direct construction of miniflare's Headers from request.rawHeaders. This avoids the type incompatibility between remix and undici Headers entirely, removes the redundant intermediate copy step, and correctly preserves multi-value headers by using append() instead of set().
be99cfc to
5b3c9f0
Compare
Fixes #13013.
Bumps undici from 7.24.4 to 7.24.8, which includes the upstream fix (nodejs/undici#5006) for
isTraversableNavigable()returningtrueunconditionally. This caused POST/PUT requests with non-2xx responses (e.g. 401) to throwTypeError: fetch failedbecause undici entered the 401 credential-retry block and failed on stream-backed request bodies.Since the fix is now included upstream, this PR removes the pnpm patch we applied in #13058 as a workaround.
Changes
undiciandundici-typesfrom 7.24.4 → 7.24.8 in the pnpm catalogundici@7.24.4frompatchedDependenciesand deletepatches/undici@7.24.4.patch@ts-expect-errordirectives on theclone()overrides insrc/http/request.tsandsrc/http/response.ts(undici 7.24.8 types no longer error on these)SpecIterableIteratortype incompatibility in R2 tests — use structural types forkeys/delimitedPrefixeshelpers instead ofR2Objectsfrom@cloudflare/workers-types(removes unusedR2Objectsimport)SpecIterableIteratortype incompatibility in vite-pluginwebsockets.ts— convert@remix-run/node-fetch-serverHeaderstoRecord<string, string>before passing tominiflare.dispatchFetchdispatchFetchReviewer notes
undici@7.24.4(unpatched) still appears in the lockfile as a transitive dependency of an older bundled miniflare version — this is expected and harmless since workspace packages now resolve to 7.24.8.dispatchFetchwhich routes through undici'sfetch()to workerd, covering the exact code path that was broken.@ts-ignorecomments on thesuper.clone()calls are intentionally kept — only the outer@ts-expect-errordirectives (which suppressed the method-override error) became unused with the new types.Headers.keys()to returnSpecIterableIterator<string>instead ofIterableIterator<string>. This causes type mismatches wherever third-partyHeaderstypes (e.g.@cloudflare/workers-types,@remix-run/node-fetch-server) are passed to undici-typed APIs. The fixes in this PR work around these at the call sites.@ts-expect-errorremovals are safe — confirm thatclone()andstatusoverrides still compile correctly with undici 7.24.8 types (CI build will confirm this)@ts-expect-errordirectives in miniflare reference undici types that may have changedwebsockets.tsRecord<string, string>conversion —headers.forEachcollapses multi-value headers to a single value per key; verify this is acceptable for WebSocket upgrade requestsHeadersobjects cross the undici / workers-types boundary that may also need fixingLink to Devin session: https://app.devin.ai/sessions/fea4cbb20470478ca29d0c117e41896d
Requested by: @petebacondarwin