Skip to content

Web Worker fails to load WASM with Turbopack: "Failed to execute 'fetch' on 'WorkerGlobalScope'" (blob URL context) #84782

@Jasonkoolman

Description

@Jasonkoolman

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/crazy-leaf-m4yxw4

To Reproduce

  1. Open preview in new window
  2. Open chrome devtools (console)
  3. Observe error:
Image

Current vs. Expected behavior

Current behavior:
When running my Next.js app with Turbopack (next dev --turbo), my web worker fails to load a WASM file. The error shown is:

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from openscad.wasm

The worker’s self.location.href is a blob URL (e.g., blob:http://localhost:3000/...), and the WASM file cannot be found or loaded.

Expected behavior:
The web worker should be able to load the WASM file successfully, just as it does when running with the default Next.js dev server (Webpack), where the worker’s location is a normal HTTP URL and asset loading works as expected.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 32503
  Available CPU cores: 24
Binaries:
  Node: 22.20.0
  npm: 10.9.3
  Yarn: N/A
  pnpm: 9.0.0
Relevant Packages:
  next: 15.5.0 // There is a newer version (15.5.4) available, upgrade recommended!
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.5.4) available, upgrade recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

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

Not sure, Turbopack

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

next dev (local)

Additional context

  • The issue occurs locally during development with Next.js using Turbopack (next dev --turbo).
  • The issue occurs inside of openscad.js
    • The script tries to load openscad.wasm like so: new URL("openscad.wasm",import.meta.url).href
    • I have found out that the script is a blob with turbopack and regular .js file with default Next.js dev server
  • The problem does not occur when running with the default Next.js dev server (Webpack).
  • The project is part of a Turborepo monorepo setup.

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