Open princejoogie opened 2 months ago
I see that you are using @vercel/postgres
which is not compatible with the regular postgres driver. You should replace that with a different client, say for example postgres.js.
After that you need to configure drizzle to use that client and you should be good to go.
Works with local Vercel Posgres :
version: "3.5"
volumes:
postgres:
services:
postgres:
image: postgres
volumes:
- postgres:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: root
# Expose the Postgres port to the host machine,
# so you can inspect and administrate it
ports:
- "54320:5432"
pg_proxy:
image: ghcr.io/neondatabase/wsproxy:latest
environment:
APPEND_PORT: "postgres:5432"
ALLOW_ADDR_REGEX: ".*"
LOG_TRAFFIC: "true"
ports:
# Expose the WebSocket proxy port to the host machine,
# this is where @vercel/postgres will connect
- "54330:80"
depends_on:
- postgres
packages/db/src/client.ts
import { neonConfig } from '@neondatabase/serverless';
if (process.env.VERCEL_ENV === 'development') {
neonConfig.wsProxy = (host) => `${host}:54330/v1`;
neonConfig.useSecureWebSocket = false;
neonConfig.pipelineTLS = false;
neonConfig.pipelineConnect = false;
}
import { sql } from "@vercel/postgres";
import { drizzle } from "drizzle-orm/vercel-postgres";
import * as schema from "./schema";
export const db = drizzle({
client: sql,
schema,
casing: "snake_case",
});
.env
POSTGRES_URL="postgres://postgres:root@localhost:54320/db"
Provide environment information
Describe the bug
I wanted to run a local db for development so I created a
docker-compose.yml
to quickly spin up a postgres instancethen I have my
.env
point to this local dbLink to reproduction
https://github.com/princejoogie/t3-turbo-local-postgres-reproduction
To reproduce
Additional information
No response