MongoDB Connection Failed (Timeout)

Hi, first time checking out this community, so just today I’m unable to login/logout/register or pretty much do anything on a webpage I’m developing for class, it keeps giving me this error in my terminal:

Login error: MongooseError: Operation users.findOne() buffering timed out after 10000ms
at Timeout. (C:\Users\khyek\crossfit-wod-api\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:187:23)
at listOnTimeout (node:internal/timers:594:17)
at process.processTimers (node:internal/timers:529:7)

Database connection error: queryTxt ETIMEOUT

[nodemon] app crashed - waiting for file changes before starting…

Just a few days ago, I was able to test my webpage fine but then all of a sudden, nothing works, I’ve tried disabling my antivirus and such.

Can you connect on the localhost connecting locally via mongosh?

Yes, I am able to connect localhost locally but thing is I need to have access to the Cloud services as I have to put my web on a web hosting platform nearing the end of the class this semester. As per the image, I tried to use MongoDB Compass to connect to my cluster, it doesn’t work too.

And just to clarify, I’ve already added my Network Access for my db to 0.0.0.0/0

As shown in the image above, I was able to make connections with the db 2 days prior too so atm I’m a bit lost, my Cluster is active and fully operational too according to my Atlas account

Looks like there is a mix-up between locally installed, i.e. self-managed MongoDB and the cloud based MongoDB Atlas.

What is your connection string causing the timeout error?
Maybe connection to MongoDB Atlas is blocked by your network firewall.

You can try to reach the database with curl:

curl --connect-timeout 10 --silent --show-error cluster0-shard-00-00.ie3mslb.mongodb.net:27017

If you get error “It looks like you are trying to access MongoDB over HTTP on the native driver port.” then connection is not blocked by firewall and the problem is somewhere else.

Hi @Ken_Khye

The error here is that compass cannot look up the TXT record for the cluster, this is a DNS error.

Try changing DNS setting to another provider. If that does not help then use the legacy connection string format. Selecting an old driver from the connect button of your cluster in Atlas will show that.