Skip to content

SQL connection error with Heroku #27

Closed
@ideasasylum

Description

@ideasasylum

I'm trying to use the SQL connection with a Heroku database. Heroku requires SSL for postgres connections but provides a self-signed cert.

With a connection string of the form: postgres://user:password@host:post/database

Fetching: SQL
  Error: Unable to connect to database: no pg_hba.conf entry for host "xx.xxx.xx.xxx", user "Read-only", database "xxxxxxxxxxx", SSL off
  Error: Workflow failed! no pg_hba.conf entry for host "xx.xxx.xx.xxx", user "Read-only", database "xxxxxxxxxx", SSL off

With a connection string of the form postgres://user:password@host:post/database?sslmode=require

 Fetching: SQL
  Error: Unable to connect to database: self signed certificate
  Error: Workflow failed! self signed certificate

I think the solution is to add an option to ignore invalid certificates. Here

flat/src/backends/sql.ts

Lines 68 to 71 in e83e6ea

connection = await createConnection({
type: protocol,
url: config.sql_connstring,
})

I think this needs to pass an ssl object like…

connection = await createConnection({
      type: protocol,
      url: config.sql_connstring,
      ssl: {
        rejectUnauthorized: config.require_valid_cert
      }
    })

Something like that. I'm not a typescript developer but I hope that helps

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions