Skip to content

Unable to set sslmode=require parameter on a Postgres connection  #214

@deenar

Description

@deenar

Hi

I am trying to connect to a Postgres hosted by Heroku.

https://devcenter.heroku.com/articles/heroku-postgresql#heroku-postgres-ssl

import com.twitter.finagle.Postgres
val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

returns an error saying ssl is off as expected
com.twitter.finagle.postgres.codec.ServerError: no pg_hba.conf entry for host "82.2.102.2", user "xx", database "xx", SSL off

I am unable to set sslmode=require on the underlying connection. I have tried
val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.conditionally(true, _.withTransport.tlsWithoutValidation)
.withTransport.tls("amazonaws.com")
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.withTransport.tls("amazonaws.com")
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.conditionally(true, _.withTransport.tlsWithoutValidation)
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions