AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Bun Runtime On Vercel Causes Rewritten Routes To Intermittently Serve Root Page

On Vercel with Bun runtime, Next.js App Router rewrite targets intermittently return HTTP 200 with root page HTML. Removing bunVersion resolves the issue, but wrong responses can be CDN-cached, amplifying impact.

highConfidence 70%Next.jsAffected Vnext@16.2.10Affected Vbun@1.x

Origin Analysis

Vercel Bun runtime has a module resolution race during internal rewrites to dynamic segments (e.g., [locale] pages), causing a fallback to the root page; Node runtime does not reproduce the issue.
1. Deploy the linked reproduction (next-intl localePrefix 'as-needed', App Router) on Vercel with 'bunVersion': '1.x'. 2. Run the provided check.sh script against /alpha, /beta, /gamma 40 times each. 3. Observe that a fraction of unprefixed requests return HTTP 200 with root page HTML while x-matched-path and locale headers are correct. 4. Remove bunVersion from vercel.json and redeploy; failures drop to zero.

Fixing Code Block

Edge Case Audit

This hotfix reverts to Node runtime, which may have different performance characteristics or memory usage compared to Bun. Additionally, any incorrect responses already cached by the CDN must be purged, otherwise users may still receive the wrong page until cache expiration. Rollback is straightforward: re-add 'bunVersion' to vercel.json, but the original bug will reappear. Monitor node version compatibility with Next.js 16.2.10.

Ecosystem Topology