[BUG]: Property 'batch' does not exist on type 'NeonDatabase'
What version of drizzle-orm are you using?
^0.33.0
What version of drizzle-kit are you using?
No response
Describe the Bug
When I try to use db.batch(), it gives me the error: Property 'batch' does not exist on type 'NeonDatabase'
I'm using Neon as my postgres provider and am initializing my db object as such:
import { drizzle } from "drizzle-orm/neon-serverless";
import { Config } from "../config";
import { Pool, neonConfig } from "@neondatabase/serverless";
import ws from "ws";
neonConfig.webSocketConstructor = ws;
import * as schema from "../../../shared/db/";
const pool = new Pool({
connectionString: Config.POSTGRES_POOL_URI,
});
const db = drizzle(pool, { schema });
export default db;
export { pool };
Expected behavior
The Drizzle batch docs appear to claim support for Neon: https://orm.drizzle.team/docs/batch-api
Environment & setup
No response
I've just run into the same issue. Did you find any resolution @JJZFIVE ?
Looks like it's only on 'drizzle-orm/neon-http', not serverless
I've just run into the same issue. Did you find any resolution @JJZFIVE ?
Looks like it's only on 'drizzle-orm/neon-http', not serverless
Interesting. Drizzle team, is this expected behavior?
It seems to me that if I specify max: 1 it behaves the same way without wrapping my queries in a batch. I might be wrong - hope thought that I'm not.
import { drizzle, NeonDatabase } from 'drizzle-orm/neon-serverless';
import { neonConfig, Pool } from '@neondatabase/serverless';
const pool = new Pool({
connectionString: POSTGRES_NEON_DB_URL,
max: 1,
});
const db = drizzle(pool, {
logger: true,
});
Yes, it's available on neon-http, because only there you can send batch statements