-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Authentication, Deno
What problem are you facing?
I'm always getting this
error: Uncaught MongoServerSelectionError: connection <monitor> to someUuid closed
when using self-signed certificate to authenticate against remote Mongo server.
Mongo server log says `{"error":
{"code":141,"codeName":"SSLHandshakeFailed","errmsg":"no SSL certificate provided by peer; connection rejected"}`, but I'm sure I provided these SSL certs.
The issue won't occur with the same code on NodeJS, and I could connect to my Mongo server using Mongosh with the same URL as the Deno one.
What driver and relevant dependency versions are you using?
Deno: 1.30.3/1.31.1
npm:mongodb: 5.0.1/5.1.0
Steps to reproduce?
Create a self-signed CA, generate certificates for Mongo server and client, and run the following code:
import {MongoClient} from "npm:mongodb@^5.1.0" const mongoUrl = "mongodb://${hostname}/?directConnection=true&tls=true&tlsCAFile=${caPath}&tlsCertificateKeyFile=${certkeyPath}&authSource=%24external&authMechanism=MONGODB-X509" const client = new MongoClient(mongoUrl); await client.connect();