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

I'm trying to connect to a Neon DB hosted behind a Replit deployment, result: "Error:" #476

Open
genobobeno opened this issue Dec 3, 2024 · 3 comments

Comments

@genobobeno
Copy link

I don't know how to produce a reprex without username and password...

I'm running the code below, and it's outputting the word "Error:"
No explanation.

Version 1.4.7

conn <- dbConnect(Postgres()
+                   , host=myhost
+                   , port=5432
+                   , dbname='neondb'
+                   , user='neondb_owner'
+                   , password=pw)
Error:

When I tried using PostgreSQL(), I got the error:
"RPosgreSQL error: could not connect neondb_owner@myhost:5432 on dbname "neondb": ERROR: connection is insecure (try using sslmode=require)"

This kept happening no matter how I attempted to manage the sslmode issue. Which is why I tried Postgres()

@krlmlr
Copy link
Member

krlmlr commented Dec 3, 2024

Thanks, this is helpful.

Can you connect through the psql command line application? With what switches?

@genobobeno
Copy link
Author

psql "host=myhost dbname=neondb user=neondb_owner password=pw sslmode=require sslrootcert=C:\path\to\my\cert\isrgrootx1.pem"

This connected

@krlmlr
Copy link
Member

krlmlr commented Dec 11, 2024

Thanks.

https://rpostgres.r-dbi.org/reference/Postgres.html#arg-- describes (somewhat hidden) the additional arguments to dbConnect() , and points to https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS . From what I can tell, a variant like the following might work:

dbConnect(..., sslmode = "require", sslrootcert = r"(C:\...)")

Do we need to improve our documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants