I have an EC2 instance running on elastic beanstalk host our website. Our website is a node app that connects to our replicaset and then makes a query, but that query just disappears into oblivion. Here is the code that runs when the server starts:
(function() {
logger.log('info', 'called');
const MongoClient = require('mongodb').MongoClient;
var client = new MongoClient();
client.connect(process.env.MONGO_CONNECTION_STRING, mongoClientOptions, function(err, db) {
if(err) return logger.log('error', err.message);
logger.log('info', 'Connected to mongodb replset.');
var collection = db.collection(SESSION_COLLECTION_NAME);
collection.findOne({}, function(err, doc) {
if(err) return logger.log('error', err.message);
logger.log('info', doc);
});
});
})();
This code works fine locally. But on the server, all I ever see is Connected to mongodb replset.
and then nothing else. No error log or info log.
One thing to note is that the mongodb database exists in the same AWS region as our EC2 instance, but it's hosted by a third party called Compose.
So what could be going on here? I can't figure out how to debug this further.