Connection terminated unexpectedly after adding postgres.conf
Heyo, after adding a postgres.conf to my db, I always get 'Connection terminated unexpectedly'. I've tried multiple config setups, and this error arises as soon as I add any config to postgres.
This is my docker postgres setup:
db:
container_name: db
image: postgres:13
platform: linux/x86_64
ports:
- '5432:5432'
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: 123
POSTGRES_DB: solid-hour-2
volumes:
- ./postgres.conf:/etc/postgresql/postgresql.conf
- ./data:/var/lib/postgresql/data
command: postgres -c config_file=/etc/postgresql/postgresql.conf
This is a conf straight from the postgres website:
# This is a comment
log_connections = yes
log_destination = 'syslog'
search_path = '"$user", public'
shared_buffers = 128MB
And this is the error from drizzle:
Error: Connection terminated unexpectedly
at /Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PgDialect.migrate (file:///Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/node_modules/drizzle-orm/pg-core/dialect.js:37:5)
at async Module.migrate (file:///Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/node_modules/drizzle-orm/node-postgres/migrator.js:4:3)
at async Module.initDb (/Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/src/lib/server/db/db.ts:66:5)
at async eval (/Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/src/hooks.server.ts:13:3)
at async instantiateModule (file:///Users/user/Documents/solid-hour/repos/solid-hour-2-fullstack/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:54897:9)
Adding the same settings via environment variables works, though.2 Replies
I'm getting the same issue. I'm using a managed DB from neon.tech. Attempted solutions that didn't work:
- Using pg-native
- Using Client over Pool
- Having the DB and API on the same machine
- Using connectionString and specifying individual properties
wait so the error doesn't happen when you apply your settings through env?
Correct, the settings are valid and postgres applies them when I add them via environment variables. But when I try to use a conf file, it fails.