We deployed the server on Render using the transaction pooler and connected it in a Node.js environment with Prisma 7.
We set ~:6543/postgres?pgbouncer=true as the DATABASE_URL and configured it as shown in the code below.
However, we keep encountering the error
prisma:error Connection terminated due to connection timeout,
and the database connection fails consistently.
Could you please advise on how to resolve this issue?
Thank you.
import { Pool } from 'pg';
import { PrismaPg } from '@prisma/adapter-pg';
import { PrismaClient } from '../generated/prisma/client.js';
// ============================================
// ============================================
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
max: 5,
min: 0,
idleTimeoutMillis: 60000,
connectionTimeoutMillis: 2000,
});