Registry / database / google-cloud-sql

google-cloud-sql

JSON →
library2.0.0jsnpmunverified

Command-line tool for connecting to private Google Cloud SQL instances via the Cloud SQL Auth Proxy running in GKE. Current stable version 2.0.0. Enables easy TCP forwarding to private SQL instances using the Auth Proxy sidecar, with automatic credential and instance discovery. Requires node >= 20. Differentiates from manual gcloud proxy commands by automating the proxy connection and handling multiple instances.

npm install google-cloud-sql
INSTALL
IMPORT
SIG · GOOGLE-CLOUD-SQL
G
google-cloud-sql
databasejavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Connects to a Cloud SQL instance using CLI; runs from terminal, no code import needed.

npx @edosrecki/google-cloud-sql@2 -i my-project:my-region:my-instance -p 3306
Debug
Known issues
gotchaRequires Cloud SQL Auth Proxy running in the same GKE cluster. Without the proxy sidecar, the tool cannot establish a connection.
fix
Deploy the Auth Proxy sidecar container alongside your application in the pod.
affects: >=1.0.0
gotchaThe tool is designed for GKE only; it expects a Kubernetes cluster environment with appropriate service account permissions.
fix
Ensure the service account used by the pod has roles/cloudsql.client IAM role.
affects: >=1.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:3307
Cloud SQL Auth Proxy is not running or not exposed on localhost:3307.
fix
Verify the proxy sidecar is running and listening on port 3307.
Error: Could not resolve 'my-project:my-region:my-instance'
Instance connection name is incorrect or the instance does not exist.
fix
Double-check the instance connection name format: project:region:instance. Use `gcloud sql instances describe [INSTANCE_NAME]`.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
google-cloud-sql — npm install google-cloud-sql · libregistry