0
votes

I'm trying to setup an instance on my phoenix app. I'm actually able to generate the app but I'm getting an error when trying to connect to the DB:

ERROR:

21:11:31.017 [error] Postgrex.Protocol (#PID<0.2223.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (/tmp/cloudsql/statcasters:us-central1:statcastersdb): no such file or directory - :enoent

I'm not sure what is wrong? The file seems to exist but it seems to say it doesn't:

prod.secret.exs:

config :statcasters, Statcasters.Repo,
  username: "postgres",
  password: System.get_env("DATABASE_PASSWORD"),
  database: "statcasters_prod",
  socket: "/tmp/cloudsql/statcasters:us-central1:statcastersdb",
  pool_size: 20

I'm not sure what more information I can give? Does anybody know what I could be missing here?

1
I'm unfamiliar with "phoenix" but you mention using App Engine. There are 2 flavors of App Engine so please see the instructions linked here. The socket name appears to include a redundant "/tmp" prefix, should be "/cloudsql/..." for App Engine standard. cloud.google.com/sql/docs/postgres/connect-app-engine - DazWilkin
@DazWilkin I am positive this comment might be turned into the answer. - Aleksei Matiushkin

1 Answers

2
votes

There are 2 flavors of App Engine so please see the instructions linked here: https://cloud.google.com/sql/docs/postgres/connect-app-engine

The socket name appears to include a redundant "/tmp" prefix and should start with "/cloudsql/..." for App Engine standard.