Connecting to Aws documentDB Using Mongoose Giving Error: 'Mongoparseerror: Option Ssl_Ca_Certs Is Not Supported'

Hello I am just trying to connect to my documentDb using mongoose; hosted on AWS. From my local pc, I am try to do it like:

const URI = 'mongodb://username::27017/?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'

mongoose.connect(URI, { useNewUrlParser: true , ssl: true});

I am getting the error:

MongoParseError: option ssl_ca_certs is not supported

Can any1 explain to me what I am doing wrong?

6

3 Answers

DocumentDB supports TLS protocol. It worked for me when I

1/ downloaded the TLS public key using

wget 

2/ changed the parameter ssl=true to tls=true in the connection string,

3/ and updated the params to connect() method.

const uri = 'mongodb://<user>:<password>@<clusterAddress>:27017/?tls=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'
const client = new MongoClient(uri,{tlsCAFile: `rds-combined-ca-bundle.pem`});

try{
    await client.connect();
}

I referred to this DocumentDB documentation.

1

I had the same issue, which I resolved by following method.

 mongodb://username:password@host_cluster:port_number/database_name?tls=true&ssl=true&tlsCAFile=xyz.bundle.pem&retryWrites=false&replicaSet=replicaSetName

Try sslCA insted of ssl_ca_certs.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest