Vercel connections timeout when using a transaction

Hi

We are using Drizzle together with the TCP Pool pg client.
import { drizzle as drizzlePg } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';

import * as schema from './schema';
import { getXataClient } from './xata';

export const xata = getXataClient();

const pool = new Pool({
  connectionString: xata.sql.connectionString,
  max: 1,
});

export const db = drizzlePg(pool, {
  schema,
});


I have also tried
const pool = new Pool({
  connectionString: xata.sql.connectionString,
  max: 1,
  maxUses: 1,
  connectionTimeoutMillis: 5000,
  idleTimeoutMillis: 1000,
  allowExitOnIdle: true,
});

which just makes at least the serverless function not run until its own timeout is reached.

However, the serverless function times out when we want to use a transaction. This only happens when deployed to Vercel.

I tried to check how many connections we have using pgAdmin. But there are none, which I think we are just not allowed to see, because my current one should show up.

How can I use transactions on Vercel using Drizzle? This is currently a major blocker.
I read some threads here of a 40 connection limit. When reading stuff like this https://neon.tech/docs/connect/connection-pooling#connection-pooling it makes me question if Xata can even handle TCP in serverless functions.

Would a dedicated Cluster solve this issue?
Was this page helpful?