Skip to content

Error when connecting to Amazon DocumentDB due to default_source #1214

Closed
@kbuman-embotech

Description

@kbuman-embotech

Versions/Environment

  1. What version of Rust are you using? 1.76.0
  2. What operating system are you using? Ubuntu 20.04.6 LTS
  3. What versions of the driver and its dependencies are you using? [email protected],[email protected]
  4. What version of MongoDB are you using? 5.0.0
  5. What is your MongoDB topology? Amazon DocumentDB

Bug description

In the case of AuthMechanism::MongoDbAws, the implementation of default_source<'a>(&'a self, uri_db: Option<&'a str>) -> &'a str[] in client/auth.rs returns $external, which is used to overwrite the target_db field of the hello command in handshake.rs. However, running hello and isMaster is not supported on $external in Amazon DocumentDB deployments:

"ok": 0,
"code": 73,
"errmsg": "Command isMaster not supported on $external database."

Expected behavior

I expect to be able to handshake and connect to Amazon DocumentDB clusters by using a connection string of the form mongodb://<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&authMechanism=MONGODB-AWS.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy an Amazon DocumentDB cluster.
  2. Create the necessary IAM role and instance profile.
  3. Associate an EC2 instance with the instance profile created in 2..
  4. Login to the EC2 instance using SSH.
  5. Use mongo-rust-driver to connect to the cluster created in 1. with a connection string of the form mongodb://<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&authMechanism=MONGODB-AWS.
  6. Bug occurs.

Note
I am not entirely certain whether this is actually a bug in mongo-rust-driver, or a configuration issue on the part of AWS. I was able to connect to my cluster by making the hello command in the handshake target the admin database.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions