PrismaP
Prisma3mo ago
2 replies
joaoh9

Trouble connecting to db.prisma.io via pgbouncer

I debuged for 6+ hours on my own and could not connect to my prisma postgres instance via pgbouncer.
I was able to do so with an RDS instance and a local postgres SQL instance.
Please help me debug it

I can successfully connect to the db.prisma.io instance from the pgbouncer VPS with this command
psql -h db.prisma.io -p 5432 -U username -d postgres

This is my /etc/pgbouncer/pgbouncer.ini file:

[databases]
* = host=db.prisma.io port=5432

[pgbouncer]
listen_addr = 0.0.0.0
listen_port = 6432
# auth_type = md5
auth_type = scram-sha-256
auth_file = /etc/pgbouncer/userlist.txt
pool_mode = transaction
default_pool_size = 20
server_reset_query = DISCARD ALL
server_reset_query_always = 1
max_prepared_statements = 1
max_client_conn = 100
min_pool_size = 1
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
client_tls_sslmode = require
client_tls_cert_file = /etc/pgbouncer/server.crt
client_tls_key_file = /etc/pgbouncer/server.key
server_tls_sslmode = require
# server_tls_cert_file = /etc/pgbouncer/server.crt
# server_tls_key_file = /etc/pgbouncer/server.key
# server_tls_ca_file = /etc/pgbouncer/ca.crt


And I have the password on userlist.txt file as plaintext ("username" "password"

I generated a server.crt from cloudflare

Am trying to connect to the pgbouncer instance from my machine with command postgresql://username@ec2-instance-ip:6432/postgres?sslmode=require

But I always get a connection timeout error
Was this page helpful?