From 392c4b88d033d2d175541b974189a3f4da49e335 Mon Sep 17 00:00:00 2001 From: alvarius Date: Mon, 11 Dec 2023 18:40:42 +0000 Subject: [PATCH] fix(store-indexer): disable prepared statements (#2058) --- .changeset/rich-experts-hope.md | 5 +++++ packages/store-indexer/bin/postgres-frontend.ts | 2 +- packages/store-indexer/bin/postgres-indexer.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/rich-experts-hope.md diff --git a/.changeset/rich-experts-hope.md b/.changeset/rich-experts-hope.md new file mode 100644 index 0000000000..8adc040361 --- /dev/null +++ b/.changeset/rich-experts-hope.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store-indexer": patch +--- + +Disabled prepared statements for the postgres indexer, which led to issues in combination with `pgBouncer`. diff --git a/packages/store-indexer/bin/postgres-frontend.ts b/packages/store-indexer/bin/postgres-frontend.ts index 3663041dd2..6fec89b174 100644 --- a/packages/store-indexer/bin/postgres-frontend.ts +++ b/packages/store-indexer/bin/postgres-frontend.ts @@ -22,7 +22,7 @@ const env = parseEnv( ) ); -const database = postgres(env.DATABASE_URL); +const database = postgres(env.DATABASE_URL, { prepare: false }); const server = new Koa(); diff --git a/packages/store-indexer/bin/postgres-indexer.ts b/packages/store-indexer/bin/postgres-indexer.ts index 95d659a280..e62d3813c3 100644 --- a/packages/store-indexer/bin/postgres-indexer.ts +++ b/packages/store-indexer/bin/postgres-indexer.ts @@ -35,7 +35,7 @@ const publicClient = createPublicClient({ }); const chainId = await publicClient.getChainId(); -const database = drizzle(postgres(env.DATABASE_URL)); +const database = drizzle(postgres(env.DATABASE_URL, { prepare: false })); if (await shouldCleanDatabase(database, chainId)) { console.log("outdated database detected, clearing data to start fresh");