CodexBloom - Programming Q&A Platform

GCP Cloud SQL Connection Issues from App Engine with Node.js and Sequelize

πŸ‘€ Views: 299 πŸ’¬ Answers: 1 πŸ“… Created: 2025-08-22
gcp cloud-sql sequelize app-engine JavaScript

I'm having a hard time understanding I'm trying to figure out I'm working with connection issues when attempting to connect my App Engine application to a Cloud SQL instance using Sequelize... My application is built with Node.js and is set to run in the Standard environment. I have configured my `database.json` file as follows: ```json { "development": { "username": "your-username", "password": "your-password", "database": "your-database", "host": "your-cloud-sql-instance-ip", "dialect": "mysql" } } ``` Despite using the correct credentials, I keep receiving the following behavior message: ``` SequelizeConnectionError: connect ETIMEDOUT <CLOUD_SQL_IP>:3306 ``` I've verified that my Cloud SQL instance is set to allow connections from App Engine. The service account associated with my App Engine is granted the `Cloud SQL Client` role, and I've also enabled the necessary API access. To troubleshoot, I tried connecting to the Cloud SQL instance from my local machine using the same credentials and it worked without any issues. I also attempted to use the Cloud SQL connection string format with the `cloud-sql-proxy`, but the connection still times out. Here’s the command I used to start the proxy: ```bash ./cloud_sql_proxy -instances=YOUR_PROJECT_ID:YOUR_REGION:YOUR_INSTANCE_NAME=tcp:3306 ``` After running the proxy, I updated my `host` property in `database.json` to `127.0.0.1`, but I still run into the connection timeout scenario when deploying to App Engine. I've checked my firewall rules and they seem to be allowing traffic as expected. Can anyone provide guidance on what might be misconfigured or overlooked in this setup? Are there specific configurations for Sequelize that could affect the connection to Cloud SQL in App Engine? I'm working in a CentOS environment. Has anyone dealt with something similar? This is for a REST API running on Linux.