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

Turbopack Double-Encodes ?Dpl Suffix In WASM Chunk Fetch Causing 404 On Vercel

WASM chunks fetched via Turbopack fail with 404 on Vercel because the deployment suffix (?dpl=...) is appended twice: once by .q() and once by N() after URL-encoding the first occurrence into %3Fdpl%3D.

highConfidence 85%Next.jsReact Server ComponentsPages RouterServer ActionsAffected V16.2.0Affected V16.2.1Affected V16.2.2

Origin Analysis

In the Turbopack runtime, WASM chunk paths registered by .q() already include the ?dpl= suffix. When loadWebAssembly passes that path to N(), N() encodes the '?' as %3F, then appends another ?dpl= suffix. The resulting URL has the deployment suffix twice, once percent-encoded in the path and once as a proper query parameter, causing Vercel to return 404.
1. Clone https://github.com/zookanalytics/vercel_wasm 2. Deploy to Vercel 3. Open browser DevTools Network tab 4. Observe .wasm request with %3Fdpl%3D in the path returns 404

Fixing Code Block

Edge Case Audit

This is a postbuild workaround, not an official upstream fix. The patch modifies generated files and must be re-run after every `next build` (add as a postbuild script). It assumes the only query parameter on WASM chunk paths is the Vercel ?dpl suffix; if future versions add other query parameters, they will be stripped. The regex may inadvertently match non-WASM fetch(N(...)) calls, but such calls are currently absent. Test thoroughly in a staging deployment before production. Keep a backup of the original runtime files or rebuild without the patch to roll back. Do not apply on Next.js 16.1.7 or any version that already includes the fix.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state