I've set up a MongoDB cluster on Atlas and have been able to connect to it from Compass and a NodeJs app I'm building for about a week. today I started getting consistently the "transient" error below from the NodeJs app:
{ MongoNetworkError: connection 5 to cluster0-shard-00-01-z4j9e.azure.mongodb.net:27017 closed at TLSSocket. (/Users/ekkis/dev/tst/node_modules/mongodb-core/lib/connection/connection.js:276:9) at Object.onceWrapper (events.js:277:13) at TLSSocket.emit (events.js:194:15) at _handle.close (net.js:610:12) at TCP.done (_tls_wrap.js:386:7) name: 'MongoNetworkError', errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }
even though Compass seems to work fine. it's very slow sometimes but it works. so I tried installing the shell (v4.0.0 on OSX) and got this:
$ mongo "mongodb+srv://cluster0-z4j9e.azure.mongodb.net/test" --username tst
MongoDB shell version v4.0.0 Enter password: connecting to: mongodb+srv://cluster0-z4j9e.azure.mongodb.net/test 2019-02-24T16:48:07.460-0800 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-z4j9e.azure.mongodb.net.:27017,cluster0-shard-00-01-z4j9e.azure.mongodb.net.:27017,cluster0-shard-00-02-z4j9e.azure.mongodb.net.:27017 2019-02-24T16:48:09.971-0800 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0 2019-02-24T16:48:09.971-0800 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row. 2019-02-24T16:48:13.260-0800 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0 2019-02-24T16:48:13.260-0800 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row. 2019-02-24T16:48:16.880-0800 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0 2019-02-24T16:48:16.880-0800 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row. 2019-02-24T16:48:22.303-0800 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0 2019-02-24T16:48:22.303-0800 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row. 2019-02-24T16:48:22.303-0800 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-z4j9e.azure.mongodb.net.:27017,cluster0-shard-00-01-z4j9e.azure.mongodb.net.:27017,cluster0-shard-00-02-z4j9e.azure.mongodb.net.:27017 : connect@src/mongo/shell/mongo.js:251:13 @(connect):1:6 exception: connect failed
I can't seem to get it to work. should I recreate the cluster? what else could I do to troubleshoot?