[warning] Description: 'Authenticity is not established by certificate path validation' Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

Hey Community,

New Install Phoenix Elixir 1.14.2 OTP 25
attempting connection with Digital Ocean managed Postgres

with DigitalOcean, the issue I am running into starts with configuring TLS correctly

I have the cacertfile in the root of the project and have tried a variety of syntax variations on this. but to no avail

essentially at this point:

`[warning] Description: 'Authenticity is not established by certificate path validation'

Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing`
[error] Postgrex.Protocol (#PID<0.1566.0>) failed to connect: ** 

(Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "test1-db" does not exist'

so of course I add these as such:

  username: "postgres",
  password: "postgres",
  hostname: "remotehost.com",
  database: "remote_db",
  port: "25060",
  ssl: true,
  ssl_opts: [verify: verify_peer, cacertfile: 'ca-certificate.crt'],
  stacktrace: true,
  show_sensitive_data_on_connection_error: true,
  pool_size: 10

Once I add the ssl_opts, I get this:

warning: variable "verify_peer" does not exist and is being expanded to "verify_peer()", please use parentheses to remove the ambiguity or change the variable name
  config/dev.exs:25

** (CompileError) config/dev.exs:25: undefined function verify_peer/0 (there is no such import)

    /Users/ER/Library/CloudStorage/OneDrive-Personal/Dev/Phoenix/you_earth/config/config.exs:148: (file)

Any insights would be very much appreciated

Thanks

verify_peer should an atom as in :verify_peer.

2 Likes

That got it. Thank you.