3
votes

This is the error I'm seeing on a virginal Phoenix app I've set up to mess around:

[error] Postgrex.Protocol (#PID<0.362.0>) failed to connect: ** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification): no pg_hba.conf entry for host "24.25.201.68", user "koilqmnaakvfjg", database "dc245o0vlbprf7", SSL off

Here is my config/dev.exs:

# Configure your database
config :hello, Hello.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "koilqmnaakvfjg",
  password: "somepass",
  database: "dc245o0vlbprf7",
  hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
  pool_size: 10

Something simple I'm missing?

Edit:

My pg_hba.conf file looks like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host  all  all 0.0.0.0/0 md5
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust
1
You should allow a connection from everywhere (or limit it to 24.25.201.68) in your postgres config at 54.243.54.6. - Aleksei Matiushkin
@mudasobwa See updated question w/ pg_hba.conf - dsp_099
A sledgehammer solution would be to put the line below somewhere in this file and restart postgres: host dc245o0vlbprf7 koilqmnaakvfjg 0.0.0.0/0 password. - Aleksei Matiushkin
@mudasobwa That didn't work. What's the purpose of updating my local pg_hba if elixir is supposed to be reaching out to a remote server? - dsp_099

1 Answers

4
votes

You need to set the ssl parameter to true, and if the issue persists modify the pg_hba.conf file.

Solution:

# Configure your database
config :hello, Hello.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "koilqmnaakvfjg",
  password: "somepass",
  database: "dc245o0vlbprf7",
  hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
  pool_size: 10,
  ssl: true

Hope it helps :D

Update me on how it goes;

Good Luck;