N
Neon12mo ago
puzzled-coral

Can't connect to local db with drizzle-kit

I followed this guide: https://neon.tech/guides/local-development-with-neon#local-postgresql to set up a local database but I get this error: 'connect ECONNREFUSED ::1:443' when I try to run migrations and such. I have set the DATABASE_URL to the local connection string (postgres://postgres:postgres@db.localtest.me:5432/main?sslmode=require) and this is my drizzle.config.ts:
import { config } from 'dotenv';
import { defineConfig } from 'drizzle-kit';

config({ path: '.env.local' });

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL not found');
}

export default defineConfig({
schema: './src/db/schemas/*',
out: './migrations',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL,
},
strict: true,
verbose: true,
});
import { config } from 'dotenv';
import { defineConfig } from 'drizzle-kit';

config({ path: '.env.local' });

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL not found');
}

export default defineConfig({
schema: './src/db/schemas/*',
out: './migrations',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL,
},
strict: true,
verbose: true,
});
Neon
Local Development with Neon - Neon Guides
Learn how to efficiently develop applications locally with Neon
4 Replies
unwilling-turquoise
unwilling-turquoise11mo ago
@Fralle Can you share your code via a method (GitHub?)?
unwilling-turquoise
unwilling-turquoise11mo ago
@Fralle I wrote a guide on how to use Drizzle with Local Postgres and Neon - https://neon.tech/guides/drizzle-local-vercel.
Neon
Drizzle with Local and Serverless Postgres - Neon Guides
A step-by-step guide to configure Drizzle ORM for local and serverless Postgres.
puzzled-coral
puzzled-coralOP11mo ago
Awesome! I’ll check it out later today @Rishi Raj Jain It's working now, thank you very much 🙂 The problem was that I didn't have postgres installed so drizzle-kit used the neon serverless driver which didn't work @Rishi Raj Jain
unwilling-turquoise
unwilling-turquoise11mo ago
Glad that the guide helped! ✨

Did you find this page helpful?