Connection problems etc

Hello. I hope I’m right here.

My Ubuntu server was running pretty smoothly and without any problems until the day before yesterday. and since then this error comes up:

MongooseError: Operation `users.findOne()` buffering timed out after 10000ms
    at Timeout.<anonymous> (/home/container/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:175:23)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7) Unhandled Rejection at Promise
MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/
    at Connection.openUri (/home/container/node_modules/mongoose/lib/connection.js:825:32)
    at /home/container/node_modules/mongoose/lib/index.js:414:10
    at /home/container/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/home/container/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/home/container/node_modules/mongoose/lib/index.js:1288:10)
    at Mongoose.connect (/home/container/node_modules/mongoose/lib/index.js:413:20)
    at authorize (/home/container/index.js:54:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  reason: TopologyDescription {
    type: 'ReplicaSetNoPrimary',
    servers: Map(3) {
      'ac-0ddk8at-shard-00-00.s3lxppu.mongodb.net:27017' => [ServerDescription],
      'ac-0ddk8at-shard-00-01.s3lxppu.mongodb.net:27017' => [ServerDescription],
      'ac-0ddk8at-shard-00-02.s3lxppu.mongodb.net:27017' => [ServerDescription]
    },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: 'atlas-olf0a9-shard-0',
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
} Unhandled Rejection at Promise

The connection to MongoDB works without problems.

compass: :white_check_mark:
Windows servers: :white_check_mark:
0.0.0.0: Anyone can connect (is important for me because of my authentication bot) :white_check_mark:
27017 Port is open :white_check_mark:

With another Ubuntu server it runs without problems.
Nothing has been done. no updates or anything else…
Even if I whitelist my IP as the error message says, it doesn’t work…

1 Like

Hello @Tobias_Horacek ,

Welcome to The MongoDB Community Forums! :wave:

As you have confirmed that it is accessible via other clients, the issues seems to be with your application server. Can you please confirm a few things such as:

  • Have you restarted your ubuntu server and tried connecting again?
  • What is the version of your driver that you are using while connecting? Can you update it, if any latest update is released?
  • Are there any firewall recently activated in your server?
  • Try connecting to your Atlas cluster via terminal from your ubuntu server and check if you are able to connect or if you face any connectivity issues.
  • You mentioned Windows server in your post, however I understand that the problematic server is Ubuntu. Could you clarify the application deployment architecture? E.g. are you using Ubuntu under Windows (e.g. with WSL), and what’s the difference between this problem Ubuntu and the one that works?

Regards,
Tarun

I run a panel system there where I control my Discord Bots. and a few bots need a connection to a license server running over MongoDB
I restarted the bots and the error came that they can no longer connect. After a while it worked again and then when I restarted the connection didn’t work again
No, the Ubunut Server is an independent server and has nothing to do with Windows. I just listed where I tested it everywhere
Unfortunately, restarting didn’t help either.

How can I connect to the Via Terminal? Because I only find how to install a server but I don’t need a server ^^

you can try using mongosh

Using MongoDB:          6.0.6
Using Mongosh:          1.9.0

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

To help improve our products, anonymous usage data is collected and sent to Mong                                                                                                             oDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.

Atlas atlas-olf0a9-shard-0 [primary] test>

I get this result when connecting to the MongoDB
So does this look ok?

Current Mongosh Log ID: 646ef827dc68e74726cf2055
Connecting to:          mongodb://127.0.0.1:27015/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.9.0
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27015

And that’s what I get when I call this up. Unfortunately, I don’t know if this is generally an error or not

I got a connection twice now so the Discord Bot was able to connect. But that’s about it.
With my test panel it works without any problems and the same system is installed there as on the main server. I’m slowly not understanding it anymore