Skip to content

Turbopack: WASM fetch URLs return 404 on Vercel due to double-encoded deployment suffix #92356

@johnzook

Description

@johnzook

Link to the code that reproduces this issue

https://github.com/zookanalytics/vercel_wasm

To Reproduce

  1. Clone https://github.com/zookanalytics/vercel_wasm
  2. Deploy to Vercel (or see live deployment below)
  3. Open browser DevTools → Network tab
  4. Observe: .wasm request with %3Fdpl%3D in the path returns 404

Live deployment: https://vercelwasm.vercel.app/

It works fine running locally on dev, only manifests when deployed via Vercel as it adds the ?dpl suffix

Current vs. Expected behavior

Expected: WASM loads from /_next/static/chunks/xxx.wasm?dpl=dpl_xxx (200)

Actual: Browser requests /_next/static/chunks/xxx.wasm%3Fdpl%3Ddpl_xxx?dpl=dpl_xxx (404). The deployment suffix appears twice — once URL-encoded into the path, once as a proper query parameter.

Provide environment information

Operating System:
  Platform: linux
  Arch: arm64
  Version: #1 SMP PREEMPT Thu Nov 20 09:34:02 UTC 2025
  Available memory (MB): 32103
  Available CPU cores: 10
Binaries:
  Node: 22.22.2
  npm: 10.9.7
  Yarn: 1.22.22
  pnpm: 10.33.0
Relevant Packages:
  next: 16.2.2 // Latest available version is detected (16.2.2).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 6.0.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

Affected versions: 16.2.0, 16.2.1, 16.2.2. Works in 16.1.7.

Note: This is the same bug reported in #91778, which was auto-closed for lacking a reproduction link.

Likely Root cause:

In the Turbopack runtime (turbopack-*.js), WASM chunk paths go through two steps that both add the ?dpl= suffix:

  1. .q() appends the suffix when registering the module: "static/chunks/xxx.wasm" → "static/chunks/xxx.wasm?dpl=xxx"
  2. loadWebAssembly passes that path to N(), which encodeURIComponent's each /-separated segment (encoding the ? already in it to %3F), then appends the suffix again.

JS and CSS chunks don't hit this because they load via <script>/ tags, not fetch(). In Next.js 16.1.7, the equivalent function .v() stored paths without the suffix, so N() correctly appended it only once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions