You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @shopify/shopify-app-session-storage-postgresql package currently does not support connecting to PostgreSQL via Unix domain sockets. This is a requirement for users deploying on Google Cloud (Cloud Run, App Engine, GKE) where Cloud SQL Auth Proxy provides connections exclusively through Unix sockets at paths like /cloudsql/project:region:instance.
The Problem
In postgres-connection.ts, the constructor always parses the connection URL with new URL(dbUrl), then the init() method manually extracts hostname, port, username, password, and database to pass individually to pg.Pool:
Sets port: NaN when no port is specified (common with Unix sockets), which can cause unexpected behavior
Proposed Solution
The package already has pg-connection-string as a dependency (^2.9.1), but it is never used in postgres-connection.ts. Using it to parse the connection URL would properly handle:
Unix socket paths via the host query parameter (e.g., postgres://user:pass@/dbname?host=/cloudsql/project:region:instance)
SSL parameters
All other standard PostgreSQL connection options
This is a minimal, non-breaking change — existing TCP connection strings continue to work exactly as before.
Use Case
import{PostgreSQLSessionStorage}from'@shopify/shopify-app-session-storage-postgresql';// Google Cloud SQL via Unix socketconstshopify=shopifyApp({sessionStorage: newPostgreSQLSessionStorage('postgres://username:password@/database?host=/cloudsql/my-project:us-central1:my-instance',),// ...});
Context
Multiple users have had to fork this package to work around this limitation (see community forks on npm)
Overview
The
@shopify/shopify-app-session-storage-postgresqlpackage currently does not support connecting to PostgreSQL via Unix domain sockets. This is a requirement for users deploying on Google Cloud (Cloud Run, App Engine, GKE) where Cloud SQL Auth Proxy provides connections exclusively through Unix sockets at paths like/cloudsql/project:region:instance.The Problem
In
postgres-connection.ts, the constructor always parses the connection URL withnew URL(dbUrl), then theinit()method manually extractshostname,port,username,password, anddatabaseto pass individually topg.Pool:This approach:
?host=/cloudsql/...which is the standard PostgreSQL way to specify Unix socket pathsport: NaNwhen no port is specified (common with Unix sockets), which can cause unexpected behaviorProposed Solution
The package already has
pg-connection-stringas a dependency (^2.9.1), but it is never used inpostgres-connection.ts. Using it to parse the connection URL would properly handle:hostquery parameter (e.g.,postgres://user:pass@/dbname?host=/cloudsql/project:region:instance)This is a minimal, non-breaking change — existing TCP connection strings continue to work exactly as before.
Use Case
Context
poolConfigto Postgres session options #727 (draft,poolConfigpassthrough) and PR [FEAT] Add SSL support #2892 (SSL support) attempt to solve parts of this, but usingpg-connection-string— which is already a declared dependency — would be a more comprehensive and minimal fixpg-connection-stringv2.9.0+ has improved Unix domain socket support