I’m trying to connect to Postgres, and I’m getting the following error:
[error] Postgrex.Protocol (#PID<0.340.0>) disconnected: ** (DBConnection.ConnectionError) ssl recv (idle): closed
My config/dev.exs
file is configured as follows:
# Configure your database
config :todo_demo, TodoDemo.Repo,
show_sensitive_data_on_connection_error: true,
url: "postgres://user:pass@host/database",
ssl: true,
ssl_opts: [
verify: :verify_peer,
cacertfile: "/opt/homebrew/etc/ca-certificates/cert.pem",
server_name_indication: 'host',
parameters: [
tcp_keepalives_idle: 300,
tcp_keepalives_interval: 60,
tcp_keepalives_count: 5
]
],
stacktrace: true,
pool_size: 10
The odd thing about this is that mix ecto.migrate
works and migrates my database, but both mix ecto.create
and mix phx.server
fail me the error above.
Any help would be appreciated.