pglite icon indicating copy to clipboard operation
pglite copied to clipboard

Vector extension: a.arrayBuffer is not a function

Open shawng opened this issue 4 months ago • 1 comments

When I try to create an empty in-memory PGlite instance with the vector extension in Node, I get the following error:

TypeError: a.arrayBuffer is not a function
 ❯ ke node_modules/@electric-sql/pglite/src/extensionUtils.ts:66:47
 ❯ ue.De node_modules/@electric-sql/pglite/src/pglite.ts:395:5
 ❯ ue._checkReady node_modules/@electric-sql/pglite/src/pglite.ts:569:7
 ❯ ue.exec node_modules/@electric-sql/pglite/src/base.ts:205:5
 ❯ pglite.test.ts:4:1
      2| import { vector } from '@electric-sql/pglite/vector';
      3| const client = new PGlite({ extensions: { vector } });
      4| await client.exec('CREATE EXTENSION IF NOT EXISTS vector');
       | ^

This is the code being run (in this case using Vitest 3.2.4 on Node 22.19 on Windows 10):

import { PGlite } from '@electric-sql/pglite';
import { vector } from '@electric-sql/pglite/vector';
const client = new PGlite({ extensions: { vector } });
await client.exec('CREATE EXTENSION IF NOT EXISTS vector');

It's unclear if it's related, but I also get the flurry of two dozen The system cannot find the file specified. messages on Windows reported here: https://github.com/electric-sql/pglite/issues/657

Any ideas? Thanks!

shawng avatar Sep 04 '25 01:09 shawng

I have the same error, but only running under vitest. The same code works fine if run as a normal script.

pglite 0.3.11
vitest: 3.0.9
node 24.9..0
macOS

carderne avatar Oct 16 '25 06:10 carderne