Cant connect to mongodb cluster via mongodb package

Hey there, i have a small glitch project that connects to mongodb atlas cluster(not local), i am connecting via mongodb package, it works fine localy, but throws error on glitch.
The code to connect:

let MongoClient = require('mongodb').MongoClient;
class mongologic
    async init(path)
        let mongo;
            mongo = await MongoClient.connect(path,{ useNewUrlParser: true },{
                autoReconnect: true,
                reconnectTries: 1000000,
                reconnectInterval: 3000
            console.log("Error connecting to mongo , "+err);

It just throws on attempt to connect:
MongoNetworkError: failed to connect to server


Never seen this before, we will need a staff member to look.


Hi @GrishaDev, welcome to the Glitch forum!

Can you let us know what your Atlas IP Whitelist looks like? The error you’re seeing seems like it might be related to Atlas not allowing connections from your Glitch project’s IP address.

If that’s the problem then you’ll probably have to whitelist a pretty broad range of IP addresses or the whole internet - Glitch projects can be assigned any IP address in Amazon AWS’s us-east-1 region’s available IPs (which is at least thousands of IPs) and will change at least every few days.

Hope this helps!

Hi There, Did you ever get MongoDb to connect? Having the same issue. Thank you. John