Currently if PGBOUNCER_URLS is set on an app, and some of the env vars it refers to don't exist, then empty entries are added by gen-pgbouncer-conf.sh to /app/vendor/pgbouncer/pgbouncer.ini, like so:
As of newer pgbouncer versions (such as v1.17.0, which #170 recently updated Heroku-18/20 to), this then results in a confusing error message when pgbouncer tries to read the config:
ERROR syntax error in connection string
ERROR invalid value "host= dbname= port=" for parameter db2 in configuration
FATAL cannot load config file
In this case the "db2" refers to the second database listed in PGBOUNCER_URLS.
So if PGBOUNCER_URLS was set to DATABASE_FOO_URL DATABASE_BAR_URL DATABASE_BAZ_URL, the above error means the DATABASE_BAR_URL env var is not set, or was set to the empty string.
The fix is for the PGBOUNCER_URLS env var to be updated on the app so it doesn't refer to non-existent DB env vars.
Currently if
PGBOUNCER_URLS
is set on an app, and some of the env vars it refers to don't exist, then empty entries are added bygen-pgbouncer-conf.sh
to/app/vendor/pgbouncer/pgbouncer.ini
, like so:As of newer pgbouncer versions (such as v1.17.0, which #170 recently updated Heroku-18/20 to), this then results in a confusing error message when pgbouncer tries to read the config:
In this case the "db2" refers to the second database listed in
PGBOUNCER_URLS
.So if
PGBOUNCER_URLS
was set toDATABASE_FOO_URL DATABASE_BAR_URL DATABASE_BAZ_URL
, the above error means theDATABASE_BAR_URL
env var is not set, or was set to the empty string.The fix is for the
PGBOUNCER_URLS
env var to be updated on the app so it doesn't refer to non-existent DB env vars.To improve the UX here,
gen-pgbouncer-conf.sh
should really check for empty values here, and fail early with a clear error message: https://github.com/heroku/heroku-buildpack-pgbouncer/blob/92598696b88b522dd792861fdf795372b9f3a537/bin/gen-pgbouncer-conf.sh#L47-L49