Skip to content

Server Compatibility: NotSupported: Classic workers are not supported error #65

@nestarz

Description

@nestarz

I'm encountering an issue when trying to use @motherduck/wasm-client in a Deno environment. I'm receiving the following error:

error: Uncaught (in promise) NotSupported: Classic workers are not supported.
    at createWorker (ext:runtime/11_workers.js:51:10)
    at new Worker (ext:runtime/11_workers.js:126:16)
    at Sn (file:///src/node_modules/.deno/@motherduck+wasm-client@0.6.6/node_modules/@motherduck/wasm-client/index.js:1:88530)
    at eventLoopTick (ext:core/01_core.js:178:7)

This error indicates that the Worker constructor being used internally by @motherduck/wasm-client is relying on "classic workers," which are not supported in Deno. Deno's worker implementation differs from Node.js or browser environments.

Here's the minimal reproduction code:

import { MDConnection } from "npm:@motherduck/wasm-client";

const connection = MDConnection.create({
  mdToken: "YOUR_MOTHERDUCK_TOKEN",
});

await connection.isInitialized();

It would be greatly appreciated if @motherduck/wasm-client could be updated to support environments where classic Worker APIs are not available, such as Deno. This would involve adapting the worker creation mechanism to be compatible with Deno's Worker API or providing an alternative initialization method for Deno users.

It seems emscripten-core/emscripten#20452 have enable the support of Module Worker so it's seems easy ?

PS: It's also not supported on Vercel or Cloudflare Workers. Vercel error: Error: Worker is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions