MongoDB connection drops

Hello,

We are developing APIs with Codeigniter4. While MongoDB is working fine, we rarely experience a connection outage. I am sharing the error below. There seems to be a problem with DNS resolution. This problem is resolved automatically after about 1-2 minutes and everything works normally. Do you have any suggestions to never get this error? All permissions on the server side, such as firewall, are granted for MongoDB.

Thanks

{
  "title": "MongoDB\\Driver\\Exception\\InvalidArgumentException",
  "type": "MongoDB\\Driver\\Exception\\InvalidArgumentException",
  "code": 500,
  "message": "Failed to parse URI options: Failed to look up SRV record \"_mongodb._tcp.xxx.n6mhc.mongodb.net\": A temporary error occurred on an authoritative name server. Try again later.",
  "file": "/home/xxx/public_html/api/vendor/mongodb/mongodb/src/Client.php",
  "line": 118,

It does look like a DNS problem. How are you configured for DNS? Are you on wifi? Ethernet? Corporate VPN? There are many questions to ask, these are just a few. You will need to audit your DNS setup to solve this problem.