Drizzle Studio: Failed to fetch tables from database

Hello! I am struggling to connect to Drizzle Studio with my local postgres database: Failed to fetch tables from database TypeError: Cannot convert undefined or null to object
// drizzle.config.ts

import type { Config } from 'drizzle-kit'

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL env var is not set')
}

export default {
schema: './src/lib/db/schema/index',
out: './drizzle',
driver: 'pg',
dbCredentials: {
connectionString: process.env.DATABASE_URL,
},
} satisfies Config
// drizzle.config.ts

import type { Config } from 'drizzle-kit'

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL env var is not set')
}

export default {
schema: './src/lib/db/schema/index',
out: './drizzle',
driver: 'pg',
dbCredentials: {
connectionString: process.env.DATABASE_URL,
},
} satisfies Config
// src/lib/db/schema/index.ts

export * from './users'
export * from './products'
export * from './parameters'
export * from './relations'
// src/lib/db/schema/index.ts

export * from './users'
export * from './products'
export * from './parameters'
export * from './relations'
// src/lib/db/index.ts

import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from './schema'

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL env var is not set')
}

const queryClient = postgres(process.env.DATABASE_URL)
export const db = drizzle(queryClient, {
schema,
})
// src/lib/db/index.ts

import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from './schema'

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL env var is not set')
}

const queryClient = postgres(process.env.DATABASE_URL)
export const db = drizzle(queryClient, {
schema,
})
Connecting via the query client works fine. Any help would be appreciated!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server