Skip to content

DuckDB-Wasm fails to load in electron with nodeIntegrationInWorker enabled #1432

Closed
@MasterOdin

Description

@MasterOdin

What happens?

When I have the nodeIntegrationInWorker flag enabled in electron, then when I go load/use duckdb-wasm, I get the following error:

TypeError: ic(...).dirname is not a function
    at cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:10:59232
    at Go.instantiateImpl (cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:11:25177)
    at Go.instantiate (cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:11:15869)
    at lc.instantiate (cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:24:10893)
    at lc.onMessage (cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:10:53913)
    at Qu.globalThis.onmessage (cdn.jsdelivr.net/npm/@duckdb/[email protected]/dist/duckdb-browser-eh.worker.js:24:10976)

If I disable the flag, then the library loads fine and seems to work fine, though I've not heavily tested the functionality beyond a simple query.

To Reproduce

See https://github.com/MasterOdin/electron-duckdb-wasm. Changing this line:

https://github.com/MasterOdin/electron-duckdb-wasm/blob/1cd5f871eac0fa1a24d9807b0f8a9ab4eac3c78f/main.js#L14

where if it's true then will see the above error, and if it's false then the query runs and I get my result.

Browser/Environment:

Electron 26 (Chrome 116.0.5845.62), though have seen this for Electron 19 as well.

Device:

Macbook Pro

DuckDB-Wasm Version:

1.27.0

DuckDB-Wasm Deployment:

JS Delivr

Full Name:

Matthew Peveler

Affiliation:

PopSQL

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