Skip to content

examples/bare-node not working #1912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nite opened this issue Nov 6, 2024 · 1 comment
Open

examples/bare-node not working #1912

nite opened this issue Nov 6, 2024 · 1 comment

Comments

@nite
Copy link

nite commented Nov 6, 2024

What happens?

The examples/bare-node example isnt working with node 22/23

To Reproduce

Change the Worker import to

const { Worker } = require('worker_threads');

and run

 node .\node-duckdb.js
TypeError: this._worker.addEventListener is not a function
    at f.attach (...@duckdb\duckdb-wasm\dist\duckdb-node.cjs:1:13364)
    at new f (...\@duckdb\duckdb-wasm\dist\duckdb-node.cjs:1:13283)
    at ...node-duckdb.js:21:20

Browser/Environment:

node 22/23

Device:

windows (also tried ubuntu)

DuckDB-Wasm Version:

1.29.0

DuckDB-Wasm Deployment:

node

@declann
Copy link

declann commented Apr 14, 2025

The code needs web-worker - I believe the API pattern for web workers versus node worker threads is different.

I think an issue here is that package.json doesn't refer to web-worker, so it isn't installed by npm install.

I got bare-node working by doing npm i --save web-worker@1.4.1

Note the version pinning: v1.5.0 of web-worker has a regression that I reported here

Hopefully this points to a fix for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants