Rust driver : DnsResolve { message: "No connections available" }


I’ve been trying to run a very simple program, to test out mongo with rust. However, I can’t seem to connect at all

I keep getting DnsResolve { message: "No connections available" }
My coworkers, running the exact same code are getting no errors. So it must be a problem on my side but there is no documentation or info anywhere to help me find out what this problem could be.

Here is the code, with credentials obstructed obv

use mongodb::{bson::doc, options::ClientOptions, Client};

use std::error::Error;

async fn main() -> Result<(), Box<dyn Error>> {
     let uri = "mongodb+srv://<uname>:<pw>";
     let mut client_options = ClientOptions::parse(uri).await.unwrap();

    client_options.app_name = Some("My App".to_string());

   ERROR HERE >>> let client: Client = Client::with_options(client_options).unwrap();
    let mut client_options = ClientOptions::parse(uri).await.unwrap();

   ... Do stuff with client


Help is appreciated. Thanks in advance

Hi @FQuark,

I’m not too familiar with rust but based off the error, it might be related to the DNS resolution of the SRV record. Are your co-workers connecting to the cluster using a different network?

Could you also try the following from the same client and advise the output?

nslookup -type=srv
nslookup -type=txt

From my own network I was able to resolve the 3 hostnames associated with the above record.

Look forward to hearing from you.