Skip to content

opfs: error calling db.open #1947

Open
Open
@qw-in

Description

What happens?

Trying to replicate the following opfs unit test:

const logger = new duckdb.ConsoleLogger(LogLevel.ERROR);
const worker = new Worker(bundle().mainWorker!);
db = new duckdb.AsyncDuckDB(logger, worker);
await db.instantiate(bundle().mainModule, bundle().pthreadWorker);
await db.open({
path: 'opfs://test.db',
accessMode: duckdb.DuckDBAccessMode.READ_WRITE
});
conn = await db.connect();

In this stackblitz playground

I am seeing the this error (open the preview in a new tab):

Error: Opening the database failed with error: {"exception_type":"IO","exception_message":"The file \"opfs://test.db\" exists, but it is not a valid DuckDB database file!"}
    open https://vitejsvitep9xkszdp-2g04--5173--1b4252dd.local-corp.webcontainer.io/node_modules/.pnpm/@duckdb+duckdb-wasm@1.29.1-dev53.0/node_modules/@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js:1
    onMessage https://vitejsvitep9xkszdp-2g04--5173--1b4252dd.local-corp.webcontainer.io/node_modules/.pnpm/@duckdb+duckdb-wasm@1.29.1-dev53.0/node_modules/@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js:1
    onmessage https://vitejsvitep9xkszdp-2g04--5173--1b4252dd.local-corp.webcontainer.io/node_modules/.pnpm/@duckdb+duckdb-wasm@1.29.1-dev53.0/node_modules/@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js:1
duckdb-browser-eh.worker.js:1:729159

Related: #1856

To Reproduce

  1. Open the playground: https://stackblitz.com/edit/vitejs-vite-p9xkszdp?file=src%2Fmain.ts
  2. See the developer tools console on the preview (open preview in a new tab)

Browser/Environment:

Chrome 131.0.6778.265, Firefox 134.0.2

Device:

macOS (M1)

DuckDB-Wasm Version:

1.29.1-dev53.0

DuckDB-Wasm Deployment:

https://stackblitz.com/edit/vitejs-vite-p9xkszdp?file=src%2Fmain.ts (don't really understand this...)

Full Name:

Quinn Blenkinsop

Affiliation:

None

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