When I try to connect second generation Cloud mysql with app engine using sequilize it give me following Error:
{"name":"SequelizeConnectionError","parent":{"errno":"ENOENT","code":"ENOENT","syscall":"connect","address":"/cloudsql/phrasal-charger-215107:asia-south1:newdish123","fatal":true},"original":{"errno":"ENOENT","code":"ENOENT","syscall":"connect","address":"/cloudsql/phrasal-charger-215107:asia-south1:newdish123","fatal":true}}
Sequelize option set:-
const db = new Sequelize(
config.database.db,
config.database.username,
config.database.password,
{
host:'localhost',
dialect: "mysql",
port: 3306,
dialectOptions: {
socketPath: '/cloudsql/phrasal-charger-215107:asia-south1:newdish123'
}
}
);
app.yaml
runtime: nodejs
env: flex
beta_settings:
cloud_sql_instances: phrasal-charger-215107:asia-south1:newdish123
MORE INFO
I tried putting '/cloudsql/phrasal-charger-215107:asia-south1:newdish123' in host didn't work.
when I put public ip address in the host given by CloudSQL and setting my ip with GCP as authorised ip then the sequelize is running perfectly and performing operation as expected.