Skip to content

fix: use keyword-value DSN format to avoid IAM token URL breakage - #18

Merged
gcaracuel merged 1 commit into
masterfrom
fix/dsn-keyword-format
Aug 13, 2026
Merged

gcaracuel merged 1 commit into
masterfrom
fix/dsn-keyword-format

Conversation

@gcaracuel

Copy link
Copy Markdown
Owner

IAM auth tokens contain URL-special characters (:, ?, &, =, /) which break the postgresql://user:pass@host/db?args URL format. lib/pq misparses the token as part of the hostname:

dial tcp: lookup root:paidly-prd-internal...:5432: no such host

Fix: Switch GetConnection to lib/pq's keyword-value format (host= port= user= password= dbname=) which does not rely on URL parsing and safely handles arbitrary password characters.

IAM auth tokens contain URL-special characters (:, ?, &, =, /) which
cause lib/pq to misparse the postgresql://user:pass@host/db?args URL
format. The error was:

  dial tcp: lookup root:paidly-prd-internal...:5432: no such host

because lib/pq treated the entire user:pass@... as the hostname.

Fix: use lib/pq's keyword-value format (host= port= user= password=
dbname=) which does not rely on URL parsing and handles arbitrary
password characters safely.
@gcaracuel gcaracuel self-assigned this Aug 13, 2026
@gcaracuel
gcaracuel merged commit 0981455 into master Aug 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant