connect to local postgres

Does anyone knows how to connect to a local pg with neon? I tried:
import { neon, neonConfig } from '@neondatabase/serverless'
import { drizzle } from 'drizzle-orm/neon-http'

neonConfig.fetchConnectionCache = true
let cached_db = null

const useDb = () => {
if (!cached_db){
const uri = "postgresql://localhost:5432/db"
const client = neon(uri)
cached_db = drizzle(client, {schema})
}
return cached_db
}

export const db = useDb()
import { neon, neonConfig } from '@neondatabase/serverless'
import { drizzle } from 'drizzle-orm/neon-http'

neonConfig.fetchConnectionCache = true
let cached_db = null

const useDb = () => {
if (!cached_db){
const uri = "postgresql://localhost:5432/db"
const client = neon(uri)
cached_db = drizzle(client, {schema})
}
return cached_db
}

export const db = useDb()
And I get:
ERROR [worker reload] [worker init] Database connection string format should be: postgresql://user:[email protected]/dbname?option=value
ERROR [worker reload] [worker init] Database connection string format should be: postgresql://user:[email protected]/dbname?option=value
2 Replies
Andrii Sherman
Andrii Sherman17mo ago
try this connection string postgresql://postgres@localhost:5432/db
cosbgn
cosbgnOP17mo ago
GitHub
Any way to connect from localhost? · Issue #33 · neondatabase/serve...
I would like to use an offline local instance of postgress while developing on my computer, I'm trying something like this: import { neon, neonConfig } from '@neondatabase/serverless' i...
Want results from more Discord servers?
Add your server