Failed to connect to Database - Setting up GCP app engine

北城余情 提交于 2019-12-25 02:57:12

问题


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:


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.



来源:https://stackoverflow.com/questions/55201556/failed-to-connect-to-database-setting-up-gcp-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!