Can't connect to my Postgres instance from my app

I've got a Postgres instance set up in a docker container, which allows local connections without a password:
# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
I've set a password for my postgres superuser, but my app refuses to connect (my app is outside the docker container): Connection string: POSTGRES_URI=postgresql://postgres:[email protected]:5432/next-payload-3 I've tried both with and without a password, and these are the errors respectively: With: ERROR: Error: cannot connect to Postgres: password authentication failed for user "postgres" Without: ERROR: Error: cannot connect to Postgres: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string I output the POSTGRES_URI in my config before the adapter uses it, and it looks fine. The adapter
import { postgresAdapter } from '@payloadcms/db-postgres'

db: postgresAdapter({
pool: {
connectionString: process.env.POSTGRES_URI,
},
}),
import { postgresAdapter } from '@payloadcms/db-postgres'

db: postgresAdapter({
pool: {
connectionString: process.env.POSTGRES_URI,
},
}),
I'm just not really sure if this is a postgres, payload, or drizzle issue (payload uses Drizzle under the hood). I'm betting Drizzle (because it gives me no end of problems), but was hoping someone could tell me if I've made an obvious mistake? Thanks, Nick
3 Replies
ἔρως
ἔρως4mo ago
it's an issue with the password not being correct
Nick
NickOP3mo ago
yeah, think it was just some weirdness with payload's postgres adapter. i ditched payload anyway after getting it set up. was disappointed that they added postgres but everything was still very much document based. thanks for the reply though 🙂
ἔρως
ἔρως3mo ago
you're welcome
Want results from more Discord servers?
Add your server