9

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:npassword@docdb-2022-05-31-18-46-43.cluster-cnyrbefiq91q.eu-west-2.docdb.amazonaws.com: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
  • 1
    Your connection string has the parameter ssl=true. This means the monogd process in AWS DocumentDB must have a server running with SSL support turned on and certs available. Jun 2, 2022 at 18:25
  • @barrypicker yes it does, by default
    – Josh
    Jun 2, 2022 at 18:31
  • Also running into this Jul 15, 2022 at 13:06
  • Yep also running into this... any ideas here? using node mongo driver "mongodb": "^4.3.1"
    – Moriarty
    Jul 19, 2022 at 21:51
  • same here, any solutions? Jul 20, 2022 at 16:08

3 Answers 3

11

DocumentDB supports TLS protocol. It worked for me when I

1/ downloaded the TLS public key using

wget https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

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 havnt tested this (as not working on this anymore) but will accept as answer so other people can see
    – Josh
    Aug 22, 2022 at 11:20
2

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
0

Try sslCA insted of ssl_ca_certs.

2
  • 4
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Feb 17 at 6:45
  • option sslca is not supported
    – Bersan
    Nov 16 at 13:06

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.