electric-sql / electric-sql/pglite

Add lock to indexeddb vfs so that the database can only be opened once.

Open
#85 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16k
Forks
442
Avg merge
20h 19m
Merged PRs (30d)
7

Description

Each time I try to use the `IndexedDb` I get this error.

```bash
this.program: could not access the server configuration file "/pgdata/postgresql.conf": No such file or directory
```

![image](https://github.com/electric-sql/pglite/assets/7119315/46aeafdb-c173-4f1c-918a-2f8952145391)

This is the code that trigger it:

```tsx
"use client";

import { PGlite } from "@electric-sql/pglite";
import { useEffect, useState } from "react";

export default function PgLiteComponent() {
const [data, setData] = useState("PENDING");

useEffect(() => {
(async () => {
const client = new PGlite("idb://local", { debug: 1 });
const result = await client.exec("SELECT NOW()");
setData(result);
})();
}, []);

return (


PGLite


{JSON.stringify(data ?? "", null, 2)}


);
}

```

The app halts, the error cannot be caught, so is not possible to do anything.

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.