'Can some one helpme with this blessed error?

Works on locally in many different ways but not at Heroku.

Error Log:

drainWaitQueue(topology[kWaitQueue], new error_1.MongoTopologyClosedError());

MongoTopologyClosedError: Topology is closed

Repo: https://github.com/RodBrowning/Facily-QRCode-API-com-MongoDB

app.get('/', function (req, res) {
  var statusCode = 200;
  var response = '';
  
  return mongodb_connection.connect(async (err) => {
    
    var collection = await mongodb_connection.db("qrcodes").collection("qrcodes");
    try {      
      var findResult = await collection.find({}).toArray();
      response = findResult;
      
    } catch (error) {
      statusCode = 400;
      response = error;
    }
    mongodb_connection.close();
    return res.type('json').status(statusCode).send(response);
  });

I've tried to remove the mongodb_connection.close(); but not worked.

By heroku logs --tail I could find that the error occurs around the toArray() method;



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source