fix(build): revert undici to ^7 (Bun build incompatibility) - #1378
Closed
github-actions[bot] wants to merge 1 commit into
Closed
fix(build): revert undici to ^7 (Bun build incompatibility)#1378github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
undici 8.x unconditionally destructures `markAsUncloneable` from `node:worker_threads` (lib/web/webidl/index.js), but Bun's `node:worker_threads` does not export that symbol. Since the Docker build stage runs `bun run build`, undici is evaluated under Bun during Next.js "Collecting page data" for /v1/[...route], throwing: TypeError: s.util.markAsUncloneable is not a function Error: Failed to collect page data for /v1/[...route] undici 7.x guards the same call behind a runtime-feature check and falls back to a no-op, so it loads cleanly under Bun while preserving every API the proxy uses (Agent, ProxyAgent, request, fetch, setGlobalDispatcher). Re-upgrading to undici 8 should wait until either Bun ships `markAsUncloneable` or the build stage switches to Node >= 23. CI Run: https://github.com/ding113/claude-code-hub/actions/runs/30711830763 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI Auto-Fix
Original PR: #1376 (
chore/typescript-7-latest-deps)Failed CI Run: PR Build Check - Docker Build Test
Root Cause
The Docker build (
bun run build, build stageoven/bun:debian) fails during Next.js "Collecting page data":undici 8.x (
lib/web/webidl/index.js) unconditionally destructuresmarkAsUncloneablefromnode:worker_threads:node:worker_threads.markAsUncloneabledoes not exist in Bun (confirmed:typeofisundefined), and the build runs under Bun. undici is imported directly by the proxy route (forwarder.ts,available-models.ts,gemini/auth.ts), so it is evaluated at build time, and a constructor calls the undefined function.The runtime stage (
node:trixie-slim, Node 24+) would have the symbol, but the build never reaches it.Fix Applied
package.jsonundici: ^8.9.0->^7markAsUncloneablebehind a runtime-feature check with a no-op fallback, loading cleanly under Bun. All APIs the proxy uses (Agent,ProxyAgent,request,fetch,setGlobalDispatcher) are present in 7.x.This restores the exact dependency state that was green before the upgrade commit, with no application-logic changes.
Verification
bun installresolvesundici@7.29.0require('undici')loads under Bun without throwing; all used exports presentbun run buildexits 0 locally (tsgo typecheck +next buildpage-data collection for/v1/[...route]now succeeds + post-build copy scripts)Re-upgrading to undici 8
This should be retried once one of the following holds:
markAsUncloneablein itsnode:worker_threadspolyfill, orNotes
process.*,node:crypto,node:netininstrumentation.ts/session-binding.ts/extract-client-ip.ts/private-ip.ts) are warnings only and did not fail the build.Auto-generated by Claude AI
Greptile Summary
This PR restores Bun build compatibility by downgrading the declared undici dependency from 8.9.x to the latest compatible 7.x release.
worker_threads.markAsUncloneableusage under Bun.Confidence Score: 5/5
The PR appears safe to merge, with no concrete regressions identified in the dependency downgrade.
The repository intentionally performs non-frozen installs without a committed lockfile, and all undici APIs used by current call sites remain available in version 7.
Important Files Changed
^8.9.0to^7; existing install behavior and repository API usage are compatible with the change.Reviews (1): Last reviewed commit: "fix(build): revert undici to ^7 (incompa..." | Re-trigger Greptile