Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL connection error with Heroku #27

Closed
ideasasylum opened this issue May 26, 2021 · 2 comments · Fixed by #32
Closed

SQL connection error with Heroku #27

ideasasylum opened this issue May 26, 2021 · 2 comments · Fixed by #32
Assignees
Labels
bug Something isn't working

Comments

@ideasasylum
Copy link

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

@mattrothenberg
Copy link
Contributor

Hi @ideasasylum, thank you for bringing this to our attention! We will confer internally on how best to solve this. Stay tuned!

@mattrothenberg mattrothenberg self-assigned this May 27, 2021
@mattrothenberg mattrothenberg added the bug Something isn't working label May 27, 2021
@mattrothenberg
Copy link
Contributor

Fixed by #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants