My application runs on NodeJS 4.4.7 and uses MongoDB driver 2.2.31 (not Mongoose) to connect to Azure CosmosDB. This is how I connect to the DB:
var connectionString = 'mongodb://USERNAME:PASSWORD@yyy.documents.azure.com:10255/DB_NAME?ssl=true'
var options = {
db: { j: false },
server: { autoReconnect: true, socketOptions: { connectTimeoutMS: 300000 } },
};
require('mongodb').MongoClient.connect(connectionString, options, callback);
And I recently started experiencing the following error:
MongoError: connection X to http://yyy.documents.azure.com:10255 timed out
where X is a small integer (I've seen 8, 10, 29, and so on).
Some background info:
- Had no errors (for 30+ days) when I didn't have geo replication set up.
- Recently set up geo replication from the Azure portal (West US as a write region, East US as a read region).
- Started experiencing "no primary server available" error.
- Updated my mongodb driver from 2.0.49 to 2.2.31 and the error was gone, however immediately started experiencing "pool destroyed" error.
- Following this workaround solved the issue (i.e. remove
&replicaSet=globaldb
) - After 3 days of zero issues, I started experiencing the above "connection timed out" error. First reported error was at around Aug 16 8:24 PM EST, and last error reported was at around Aug 17 6:40 AM EST.
I'm not sure if it is a temporary issue from Azure or there is something wrong in the way I connect to CosmosDB. Any suggestion would be appreciated!