electric-sql / electric-sql/pglite

[BUG]: Error initializing database in OPFS AHP FS when using Multi-tab Worker after updating to version 0.4.2

Open
#949 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
16k
Forks
442
Avg merge
20h 19m
Merged PRs (30d)
7

Description

**Describe the bug**
```
`Uncaught (in promise) NoModificationAllowedError: Failed to execute 'createSyncAccessHandle' on 'FileSystemFileHandle': Access Handles cannot be created if there is another open Access Handle or Writable stream associated with the same file.`
```

But everything was normal in version 0.4.1

**include code**

```
// my-pglite-worker.js
import { PGlite } from '@electric-sql/pglite'
import { worker } from '@electric-sql/pglite/worker'

worker({
async init() {
// Create and return a PGlite instance
return new PGlite('opfs-ahp://path/to/datadir/')
},
})

import { PGliteWorker } from '@electric-sql/pglite/worker'

const pg = new PGliteWorker(
new Worker(new URL('./my-pglite-worker.js', import.meta.url), {
type: 'module',
}),
)
```

**Logs**

```
Uncaught (in promise) NoModificationAllowedError: Failed to execute 'createSyncAccessHandle' on 'FileSystemFileHandle': Access Handles cannot be created if there is another open Access Handle or Writable stream associated with the same file.
```

**Details**
- PGlite version 0.4.2

**Other**
Everything was normal in version 0.4.1.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.