Skip to content

Clarify IAM auth for Cloud SQL Auth Proxy Unix socket connections#94

Closed
Copilot wants to merge 2 commits intofeat-enable-sql-auth-proxyfrom
copilot/sub-pr-92-again
Closed

Clarify IAM auth for Cloud SQL Auth Proxy Unix socket connections#94
Copilot wants to merge 2 commits intofeat-enable-sql-auth-proxyfrom
copilot/sub-pr-92-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

When Cloud SQL Auth Proxy connects via Unix socket with IAM Database Authentication, the proxy handles auth — DB_PASSWORD is not needed. The previous config example incorrectly included it and omitted DB_USER/DB_NAME.

Changes

  • .env.example: Removed DB_PASSWORD; added DB_USER and DB_NAME (required by db.ts); added comment clarifying IAM handles auth
  • src/lib/db.ts: DB_PASSWORD is now conditionally applied to the pool config — omitted entirely when not set, rather than passed as undefined
const poolConfig: ConstructorParameters<typeof Pool>[0] = {
  user: dbUser,
  database: dbName,
  host: instanceUnixSocket,
};
if (dbPassword) {
  poolConfig.password = dbPassword;
}

DB_USER remains required — PostgreSQL still needs a role to connect as (the IAM service account name mapped to a PG user). Only the password is unnecessary under IAM auth.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify IAM usage for SQL Auth Proxy in response to review feedback Clarify IAM auth for Cloud SQL Auth Proxy Unix socket connections Mar 11, 2026
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.

2 participants