I have a serverless cluster name moldypages-serverless.8vk4d.mongodb.net .
For a reason I can’t track down I can connect to it with Mongo Compass but not with any other program, including my own code. I wrapped mongoose’s source code that starts the connecting with more console.logs and this is what I see:
NEW MONGO CLIENT mongodb://dan:SOMEFAKEPASSWORD@moldypages-serverless.8vk4d.mongodb.net/moldypages {
useUnifiedTopology: true,
useNewUrlParser: true,
promiseLibrary: [Function: Promise],
driverInfo: { name: 'Mongoose', version: '5.13.7' }
}
CAUGHT ERROR getaddrinfo ENOTFOUND moldypages-serverless.8vk4d.mongodb.net
/home/dan/Documents/node/moldypages/node_modules/mongodb/lib/core/sdam/topology.js:437
const timeoutError = new MongoServerSelectionError(
^
MongoServerSelectionError: getaddrinfo ENOTFOUND moldypages-serverless.8vk4d.mongodb.net
at Timeout._onTimeout (/home/dan/Documents/node/moldypages/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
reason: TopologyDescription {
type: 'Single',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map(1) {
'moldypages-serverless.8vk4d.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
}
What I find equally strange is that I can’t query the A DNS entry for moldypages-serverless.8vk4d.mongodb.net
:
drill 8.8.8.8 A moldypages-serverless.8vk4d.mongodb.net
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 55697
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;; moldypages-serverless.8vk4d.mongodb.net. IN A
;; ANSWER SECTION:
;; AUTHORITY SECTION:
mongodb.net. 60 IN SOA ns-761.awsdns-31.net. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 60
;; ADDITIONAL SECTION:
;; Query time: 14 msec
;; SERVER: 192.168.1.1
;; WHEN: Tue Aug 31 16:49:31 2021
;; MSG SIZE rcvd: 138
Is there a different procedure for connecting to a serverless cluster that I’m not aware of?