Prisma1: Unable to connect to remote Postgres DB with ssl=true

Created on 10 May 2018  路  10Comments  路  Source: prisma/prisma1

Bug Report

Prisma Version 1.8

Issue
It is not currently possible to connect to a remote PostgresDB with ssl=true the option is either ignored or not supported.

Reproduction

run > prisma init
options:

  1. Use existing database
  2. PostgreSQL
  3. No

Enter connection details for remote database.

CLI throws error:
Could not connect to database. no pg_hba.conf entry for host "86.128.185.193", user "wctuojjcmucvxh", database "d3bjoonnf7l2sq", SSL off

Expected behavior?
The CLI should connect to the remote database

kinfeature areconnectopostgres

Most helpful comment

  1. CLI version > 1.10.1 - npm install -g prisma
  2. Prisma server version > 1.10
  3. ssl: true in DB options in docker-compose.yml file.

I can confirm that this is resolved.

All 10 comments

Yup. I was having trouble connecting to an external database from pretty much any database hosting provider (AWS, Heroku, etc).

Thanks! I was able to test the alpha channel (1.10.0-alpha.24) against the latest stable version (1.8.3).

When running prisma init on the alpha channel, I was asked if I wanted to use ssl. I said I did, and it confirmed my choice. The command finished successfully which is a step in the right direction. On 1.8.3, I wasn't even able to complete prisma init without getting the same error as @warrenday above.

I was expecting that deciding to use SSL would have some impact on the resulting docker-compose.yml file, but it did not appear so. I was still getting the same issue after running docker-compose up -d followed by prisma deploy.

prisma deploy spit out it's generic failure message. In the docker logs I got the original error:

Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "98.114.12.243", user "hwouamssimxewe", database "doj9s0n5ddpli", SSL off

While prisma init seems to be able to temporarily connect to the SSL database, it doesn't seem to preserve the SSL choice in any of the files it generates.

I also wasn't able to get past this issue when trying to manually enable ssl by changing the docker-compose.yml file that was generated.

Thanks a lot for the update, @andrewjmead! We'll soon double check if any changes to docker-compose.yml need to be made, or if there is another step that needs to be taken here.

Reopening this because at the moment there is no documented way to pass the ssl value to prisma docker service.

While the CLI asks for ssl during prisma init, that information is not used by the service.

Yeah. I appears the new prisma init connects to the database just fine over SSL without a cert. It would be nice to see the same behavior carried over to the service.

We are working on this issue from the backend perspective: https://github.com/prismagraphql/prisma/pull/2594

This is not released yet but will be soon.

We will update this issue with instructions and close it then. Thanks!

That's awesome. It looks like that would work great with SSL without certs.

Thanks for this.

  1. CLI version > 1.10.1 - npm install -g prisma
  2. Prisma server version > 1.10
  3. ssl: true in DB options in docker-compose.yml file.

I can confirm that this is resolved.

Yup! This is working for me too 馃槃

Confirming is working on my end too 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bradly-kunthrope picture Bradly-kunthrope  路  37Comments

schickling picture schickling  路  36Comments

marktani picture marktani  路  34Comments

marktani picture marktani  路  62Comments

sorenbs picture sorenbs  路  52Comments