jeroen / mongolite

Fast and Simple MongoDB Client for R
https://jeroen.github.io/mongolite/
284 stars 64 forks source link

Certificate verification error when trying to connect to collection. #227

Open TWilliams2441 opened 2 years ago

TWilliams2441 commented 2 years ago

I'm getting an error when attempting to connect to a MongoDB collection using mongo() on Windows 10. I'm not having the same issue in debian based docker containers.

Error: No suitable servers found ('serverSelectionTryOnce' set): [TLS handshake failed: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed calling ismaster

The issue can be temporarily rectified using mongo(..., options = ssl_options(weak_cert_validation = TRUE))

Is this a mongolite problem, windows problem, MongoDB problem, or a combination?

I've attempted to remove and reload the ISRG X1 certificate.

jeroen commented 2 years ago

Maybe this is related to the expired lets encrypt root cert? https://letsencrypt.org/2021/10/01/cert-chaining-help.html The problem will probably be resolved when the server renews the cert?

geneorama commented 2 years ago

possible duplicate of https://github.com/jeroen/mongolite/issues/219

I'm having the same issue using Windows 10 with Mongo Atlas. I know it's something that mongolite is doing because the Python connection works with no problem.

The Python connection isn't the same though. All the mongolite connections are connecting to a thing in the database like mtcars, rather than just connecting to the server, for example: m <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") I'm not sure if mtcars is a database or collection or project, or if jeroen_test is the database / collection / project.

So it's harder to troubleshoot the connection because it's trying to do two things, I think.

jeroen commented 2 years ago

@geneorama did you first get this problem today? I just did a patch release on cran earlier today because yesterday's release 2.4.0 had a bug. Can you make sure you're on the latest mongolite 2.4.1?

geneorama commented 2 years ago

I was on 2.3.1 from CRAN, and I had run update.packages('mongolite')

Mongo support suggested adding ?tls=true&retryWrites=true&w=majority to the connection string, which didn't work in 2.3.1.

I'm in the process of downloading the latest version, and I'll try again. Thanks!

geneorama commented 2 years ago

Upgrading to 2.4.1 solved the issue for me, and the TLS part of the string didn't matter. Thanks. I don't know if my issue was the same as this issue, but it appeared to be the same as this one and #219.

Also I can connect using just the URL and not specifying a database.

Thanks again