I am trying to connect to an CloudSQL instance via Cloud Run but whenever I send a POST request the logs for the cloud run instance report:
Cloud SQL instance "INSTANCE_NAME" is not reachable. Deploy a new revision adding the Cloud SQL connection. See documentation: https://cloud.google.com/sql/docs/mysql/connect-run
and followed by
Error: connect ENOENT /cloudsql/INSTANCE_NAME at Query._callback (/app/index.js:65:35)
I have followed the documentation and added a public ip connection to my Cloud SQL instance as 0.0.0.0/0 and I added an sql connection to the instance via cloud console update command.

I have also added SQL Admin and SQL Client permissions to all my service accounts and enabled the SQL Admin extension.
When I run my code locally via TCP and I am able to send a POST request as well.
if (process.env.NODE_ENV == "production") {
const dbSocketPath = process.env.DB_SOCKET_PATH || "/cloudsql";
pool = mysql.createPool({
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
// host:<instance-public-ip> //<- works locally
// port:3306
socketPath: `${dbSocketPath}/${process.env.INSTANCE_CONNECTION_NAME}`,
});
}
I am all out of ideas, I think the socketpath /cloudsql/ does not exist. Is there a way I can check if it exists?