Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun bundle not work with PgLite #15032

Open
esciullo opened this issue Nov 7, 2024 · 1 comment
Open

Bun bundle not work with PgLite #15032

esciullo opened this issue Nov 7, 2024 · 1 comment
Labels
bug Something isn't working bundler Something to do with the bundler

Comments

@esciullo
Copy link

esciullo commented Nov 7, 2024

What version of Bun is running?

1.1.34+5e5e7c60f

What platform is your computer?

Linux 5.15.153.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Use the following index.ts and package.json files and run

bun build --compile --sourcemap ./index.ts --outfile executable && ./executable

index.ts

import { PGlite } from "@electric-sql/pglite";

const db = new PGlite();
await db.waitReady;
const result = await db.query("select 'Hello world' as message;");
console.log(result);
await db.close();

package.json

{
  "name": "pglite-bundle",
  "private": true,
  "module": "index.ts",
  "type": "module",
  "dependencies": {
    "@electric-sql/pglite": "0.2.12"
  }
}

What is the expected behavior?

The process runs successfully.

What do you see instead?

The process fails with error

ENOENT: No such file or directory
   errno: -2
 syscall: "open"
   path: "/$bunfs/root/postgres.data"

Additional information

Opened electric-sql/pglite#414 (comment) to PgLite, seems that /$bunfs/root/postgres.data is a bun generated path and it is wrong.

@esciullo esciullo added bug Something isn't working needs triage labels Nov 7, 2024
@nektro nektro added bundler Something to do with the bundler and removed needs triage labels Nov 8, 2024
@LexSerest
Copy link

quick fix:

 find node_modules/ -iname "postgres.????" -exec cp "{}" . \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler
Projects
None yet
Development

No branches or pull requests

3 participants