NeonN
Neon2y ago
6 replies
unexpected-ivory

Unable to connect to PGbouncer through NeonDB.

Hello,

I'm attempting to connect NeonDB to the PgBouncer Docker image (edoburu/pgbouncer). However, when I try to connect using pgAdmin, I encounter the following error:

Unable to connect to server: connection failed: FATAL: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=endpoint%3D<endpoint-id>'. See more at https://neon.tech/sni

I tried adding the endpoint ID as follows:

Python
conn = psycopg2.connect( host="localhost", port="6432", dbname="orders", user="xxxxx", password="xxxxxx", options=f'-c endpoint={endpoint_id}' )

But I receive this error instead:

Error: connection to server at "localhost" (127.0.0.1), port 6432 failed: FATAL: unsupported startup parameter in options: endpoint

I installed PGbouncer both locally and in a Docker container using the 0.0.0.0 host configuration, which is why I'm using host="localhost". I added the NeonDB credentials to both the DATABASE_URL and pgbouncer.ini files, but I'm still facing the same two errors. I created a custom Dockerfile for PGbouncer, upgrading both the libpq file and PostgreSQL to version 15, but the issue remains. Does anyone know how to fix this?

docker-compose
version: '3.8' services: pgbouncer: image: edoburu/pgbouncer environment: DATABASE_URL: "postgresql://xxxxxxx:xxxxxxxxx@ep-long-tree-a5szmpk2-pooler.us-east-2.aws.neon.tech/orders" volumes: - ./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini - ./userlist.txt:/etc/pgbouncer/userlist.txt ports: - "6432:6432" restart: always
Screenshot_from_2024-06-18_20-45-23.png
Screenshot_from_2024-06-21_20-42-52.png
Was this page helpful?