Error when trying to connect to managed DB on Digital Ocean

I am attempting to deploy using elixir releases. I am using a managed DB on Digital Ocean. After going through all the steps for a release, when I try to start the app I get back this issue:

03:52:07.444 [error] Postgrex.Protocol (#PID<0.1407.0>) failed to connect: ** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) no pg_hba.conf entry for host "68.183.57.202", user "app_prod", database "app_prod", SSL off

The number 68.183.57.202 is the IP to my managed DB. I did run export DATABASE_URL=<my_url> which includes the username, password, db, and hostname. I looked at several other issues but since I am not a DB guru it’s hard to parse through content. Any help is appreciated.

Sounds like you can’t access the database from the host?

Have you tried using psql to connect?

2 Likes

I have seen this before but I don’t know what it means. Any reference material I can read up on about it as it relates to DO.

This seems like the issue from my limited knowledge.

You probably already found it but, for posterity:

https://www.postgresql.org/docs/current/app-psql.html

If you cannot connect with it then there’s a problem that’s outside Elixir.

1 Like

Don’t know about the DO specifics, I have however seen this exact error (on azure managed service) when either the IP of the host is not added as an authorised IP or the server is set to require SSL connections and the client does not set ssl true in the ecto repo config.

Edit: inclined to think it will be the SSL issue

2 Likes

I will try this out today

Thanks for the details. I will test this out

So I believe the answer was setting ssl: true in my prod.secret.exs file since I was able to connect to my db from the server I am running my app from.

3 Likes

Thanks, this helped me