Switched to Neon Websockets but now some queries are timing out

Hi everyone, I was using transactions for a specific query (needed all of them to cancel if one failed for a form builder). So I followed this tutorial to switch from Neon HTTP to Neon Websockets: https://orm.drizzle.team/docs/connect-neon But now I'm seeing that other queries are extremely slow & some are even failing (see attached screenshot)
Drizzle ORM - Neon
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
No description
4 Replies
MarvinKR
MarvinKROP4mo ago
Tried this fix, can I combine both methods in a single drizzle file and use only dbPool for transactions?
import { Pool, neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";
import { drizzle as drizzleHttp } from "drizzle-orm/neon-http";
import * as schema from "@/db/schema";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export const dbPool = drizzle(pool, { schema });

const sql = neon(process.env.DATABASE_URL!);
export const db = drizzleHttp(sql, { schema });
import { Pool, neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";
import { drizzle as drizzleHttp } from "drizzle-orm/neon-http";
import * as schema from "@/db/schema";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export const dbPool = drizzle(pool, { schema });

const sql = neon(process.env.DATABASE_URL!);
export const db = drizzleHttp(sql, { schema });
@raoufchebri
kizzyman
kizzyman2mo ago
@MarvinKR Did you get an answer on this?
MarvinKR
MarvinKROP2mo ago
I used the method above Not sure if it’s the right one but it seems to work so never looked back haha
kizzyman
kizzyman2mo ago
Just tried it and seems to work fine. The bits that require transactions are mostly for my admin panel anyway so should be fine! Thanks man 🙂

Did you find this page helpful?