Access to CloudSQL Postgres database using unix socket

I am trying to connect ForestAdmin to a Postgres database running on a unix socket - this is how Google Cloud Run applications connect to Google CloudSQL databases which is ultimately my goal (deploy forestadmin backend in docker container on Google Cloud Run).

Expected behavior

ForestAdmin should connect to my database using a valid DATABASE_URL pg connection string.

Actual behavior

Error trying to connect to database. FWIW, the connection string I am using works with Prisma 2 client.

Failure Logs

See above

Context

Please provide any relevant information about your setup.

My connection string in my .env file is:

DATABASE_URL=postgresql://postgres:@localhost/dbname?host=/Users/username/tmp/cloudsql

  • Package Version:
  • Express Version: 4.16.3
  • Sequelize Version: 5.15.1
  • Database Dialect: postgres
  • Database Version: 11
  • Project Name: regen

Hi @narciero, and Welcome to the Forest Admin community!

(I’m assuming here that you were able to fully onboard on your own localhost, and that’s the deployment process that fails, am I right?)

I’m not that familiar to the complete GCSQL/GCR environment, I’m pretty sure you can proxy the database to expose a classic database connection string, but you might not want to do this I guess ?

For now, we do not support unix socket connection string, at least from the onboarding screens. You might still be able to initialize Sequelize in the models/index.js folder using this socket though, using the dialectOptions parameters, like :

var sequelizeConfig = {
    dialect: 'postgres',
    dialectOptions: {
        socketPath: '/path/to/the/socket',
    }
    port: 5432,
};

Let me now if that helps :slight_smile:

1 Like