Improve the error message when trying to use OPFS outside of a worker
Author: TheAndrewJacksonCreated Aug 14, 2024Updated Aug 12, 2026
Description
I'm running into an issue when trying to create a new database using the OPFS AHP file system. This snippet
import { PGlite } from "@electric-sql/pglite";
const client = await PGlite.create({
dataDir: "opfs-ahp://electric.db",
relaxedDurability: true,
});is producing this error
I have a minimal-repro repo here that has the issue: https://github.com/TheAndrewJackson/opfs-ahp_bug_repro
Source: electric-sql/pglite