The new extension system is amazing 🎉 but having an issue loading extensions in a Web Worker:
Works:
import { PGlite } from '@electric-sql/pglite'
import { vector } from '@electric-sql/pglite/vector'
const db = new PGlite(`idb://my-db`, {
extensions: {
vector,
},
})
Fails:
import { PGliteWorker } from '@electric-sql/pglite/worker'
import { vector } from '@electric-sql/pglite/vector'
const db = new PGliteWorker(`idb://my-db`, {
extensions: {
vector,
},
})
with error:
DOMException: Failed to execute 'postMessage' on 'Worker': async(s,n)=>({emscriptenOpts:n,bundlePath:/* asset import */ new __webpack_req...<omitted>...}) could not be cloned.
My best guess is something to do with being enable to serialize/wrap the vector module/function when sending to the Web Worker through comlink.
The new extension system is amazing 🎉 but having an issue loading extensions in a Web Worker:
Works:
Fails:
with error:
My best guess is something to do with being enable to serialize/wrap the
vector
module/function when sending to the Web Worker throughcomlink
.This is running in a Next.js application.
Edit: will likely be fixed by https://github.com/electric-sql/pglite/pull/120