ClientAuthentication Error using heroku-postgres

What do I have to do? This one is a heroku-postgres database (actually aws), it worked using a vercel-postgres database.
xxx\node_modules\drizzle-kit\bin.cjs:23472
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);

error: no pg_hba.conf entry for host "xxx", user "xxx", database "xxx", no encryption
at Parser.parseErrorMessage (xxx\node_modules\drizzle-kit\bin.cjs:23472:98)
at Parser.handlePacket (xxx\node_modules\drizzle-kit\bin.cjs:23313:25)
at Parser.parse (xxx\node_modules\drizzle-kit\bin.cjs:23237:34)
at Socket.<anonymous> (xxx\node_modules\drizzle-kit\bin.cjs:23513:44)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:128:17) {
length: 175,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '536',
routine: 'ClientAuthentication'
}

Node.js v18.19.0
xxx\node_modules\drizzle-kit\bin.cjs:23472
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);

error: no pg_hba.conf entry for host "xxx", user "xxx", database "xxx", no encryption
at Parser.parseErrorMessage (xxx\node_modules\drizzle-kit\bin.cjs:23472:98)
at Parser.handlePacket (xxx\node_modules\drizzle-kit\bin.cjs:23313:25)
at Parser.parse (xxx\node_modules\drizzle-kit\bin.cjs:23237:34)
at Socket.<anonymous> (xxx\node_modules\drizzle-kit\bin.cjs:23513:44)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:128:17) {
length: 175,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '536',
routine: 'ClientAuthentication'
}

Node.js v18.19.0
4 Replies
Jonas
Jonas7mo ago
my config:
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
schema: "./schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
connectionString: process.env.DATABASE_HOST!
},
verbose: true
})
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
schema: "./schema.ts",
out: "./drizzle",
driver: "pg",
dbCredentials: {
connectionString: process.env.DATABASE_HOST!
},
verbose: true
})
i added ?sslmode=require to my database url. now i get DEPTH_ZERO_SELF_SIGNED_CERT. I don't have acces to the account. how am I supposed to sign it with the cert of the database? the vercel one is from neon I still don't get it What am I supposed to do? Using neon now. heroku-postgres sucks.
Peter Boling
Peter Boling6mo ago
I'm struggling with the same thing
Peter Boling
Peter Boling6mo ago
Figured it out! I had to set sslmode=require, or ssl: true, everywhere possible, and then it suddenly started working! It appears this is now required by Heroku always. https://devcenter.heroku.com/articles/connecting-heroku-postgres#heroku-postgres-ssl More: https://devcenter.heroku.com/changelog-items/2035
Connecting to Heroku Postgres | Heroku Dev Center
Connect to Redis from different programming languages and frameworks.
xvx
xvx4mo ago
The problem persisted for me when I did: - put sslmode=require at the end of the connection string - put ssl: true in postgres(conn_str, {here}) and defineConfig({..., dbCredentials: {here}) until I replaced in dbCredentials the url object with each individual pg credential (including ssl: true)
Want results from more Discord servers?
Add your server