I'm using Knex.js to connect to a Cloud SQL PostgreSQL instance, and I have double checked all my information a million times at this point with just a complete lack of understanding about why this error is happening. Here is my code:
const connectWithUnixSockets = (config) => {
const dbSocketPath = "/cloudsql"
// Establish a connection to the database
return Knex({
client: 'pg',
connection: {
user: 'postgres', // default user provided by google
password: Config.DBPass, // password for the account
database: 'ceclub', // database name
host: `${dbSocketPath}/Connection-name`,//I have checked this part a thousand times, it's correct.
},
// ... Specify additional properties here.
...config
});
}
let config = {
pool: {
max:5,
min:5,
acquireTimeoutMillis:60000,
},
createTimeoutMillis:30000,
idleTimeoutMillis:600000,
createRetryIntervalMillis:200
}
let knex = connectWithUnixSockets(config);
Before it gets asked I did just copy this from the gcloud functions documentation. I've made sure to give myself admin permissions and the service account for my VM admin permissions for Cloud SQL, and I have authorized the IP of my VM. However, everytime I run this program I end up with the following issue:
Error: connect ENOENT /cloudsql/connection-name/.s.PGSQL.5432
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'connect',
address: '/cloudsql/connection-name/.s.PGSQL.5432'
}
I have double checked the documentation a bunch and I am just at a loss for what I might have messed up. Does anyone have any ideas?