-
Notifications
You must be signed in to change notification settings - Fork 178
Closed
Description
What happens?
Hi, I'm new to using DuckDB WASM, so I apologize if I'm missing something simple.
I'm using the WASM implementation in a Svelte application. I can correctly instantiate the DuckDB connection and register a file. However, when I try to execute a query I get the error Error: _setThrew is not defined.
The https file is CORS enabled, but the same error occurs when I try to read a local file. Trying to pass the Parquet file directly to "read_parquet", within the query, produces the same error.
I appreciate any help.
To Reproduce
Here is the full Svelte code that goes into +page.svelte
<script lang="ts">
import { onMount } from "svelte";
import * as duckdb from "@duckdb/duckdb-wasm";
import duckdbWasm from '@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm?url';
import mvpWorker from '@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url';
let db;
let connection;
let errorMsg = "";
onMount(async () => {
try {
const worker = new Worker(mvpWorker);
const logger = new duckdb.ConsoleLogger();
db = new duckdb.AsyncDuckDB(logger, worker);
await db.instantiate(duckdbWasm);
connection = await db.connect();
console.log("DuckDB connection established!");
// Connect to a remote file
await db.registerFileURL('remote.parquet', 'https://mpaeu-dist.s3.amazonaws.com/source/data/species/key=1003504.parquet');
console.log("File registered");
// UP HERE IS WORKING
// Run a query
// HERE IT IS FAILING
const query = "SELECT COUNT(*) AS count FROM read_parquet('remote.parquet')";
const result = await connection.query(query);
console.log("Query executed.")
console.log(result)
} catch (error) {
errorMsg = error.message;
console.error("Error initializing DuckDB:", errorMsg);
}
});
</script>
<main>
<h1>DuckDB Initialization in Svelte</h1>
{#if errorMsg}
<p style="color: red;">Error: {errorMsg}</p>
{:else if connection}
<p>DuckDB connection is ready!</p>
{:else}
<p>Loading DuckDB...</p>
{/if}
</main>
<style>
main {
font-family: sans-serif;
padding: 2rem;
max-width: 600px;
margin: 0 auto;
}
</style>Browser/Environment:
Version 131.0.6778.267 (Official Build) (arm64)
Device:
MacOS
DuckDB-Wasm Version:
1.29.0
DuckDB-Wasm Deployment:
Local
Full Name:
Silas Principe
Affiliation:
OBIS
Metadata
Metadata
Assignees
Labels
No labels