Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect to Google Cloud SQL with node App Engine and TypeOrm

I am using typeorm and with ;extra.socketPath; in the ormconfig file. I'm getting:

Error : Error: connect ENOENT /cloudsql/[project:region:instance] at
PipeConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)

The ormConfig.json file contains the following JSON content:

{
  "type": "mysql",
  "extra": {
    "socketPath": "/cloudsql/[project:region:instance]"
  },
  "username": "root",
  "password": "xxxx",
  "database": "yyy",
  "synchronize": true,
  "logging": false,
  "entities": [
    "build/entity/**/*.js"
  ]
}
like image 391
Nishant.K Avatar asked May 07 '26 08:05

Nishant.K


1 Answers

Original poster found a fix in an identical post on TypeOrm’s github page. They got it to work by using the Cloud SQL IP as their host and changing their firewall to allow it.

like image 191
Katayoon Avatar answered May 09 '26 20:05

Katayoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!