Unable to connect to Atlas MongoDB: TypeError: Cannot read properties of undefined (reading 'constructor') at new ConnectionString

Hi, things were working fine until yesterday and all of a sudden I couldn’t connect to Atlas MongoDB with the following error:

TypeError: Cannot read properties of undefined (reading 'constructor')
    at new ConnectionString (xxxxxxxxxxx/node_modules/mongodb-connection-string-url/src/index.ts:208:94)
    at parseOptions (xxxxxxxxxxx/node_modules/mongodb/src/connection_string.ts:268:15)
    at new MongoClient (xxxxxxxxxxx/node_modules/mongodb/src/mongo_client.ts:347:34)
    at getDB (xxxxxxxxxxx/src/lib/db.ts:9:23)
    at xxxxxxxxxxx/node_modules/lodash/before.js:31:21
    at getCollection (xxxxxxxxxxx/src/lib/db.ts:18:25)
    at getNodeCollection (xxxxxxxxxxx/src/modules/10-common/lib/tree/db.ts:5:41)
    at TreeModel.init (xxxxxxxxxxx/src/modules/10-common/lib/tree/index.ts:47:46)
    at init (xxxxxxxxxxx/src/modules/exam-preparation/10-core/init.ts:4:21)
    at init (xxxxxxxxxxx/src/modules/exam-preparation/init.ts:7:13)

MongoDB version: 4.4.0

I’m guessing this has something to do with MongoDB Atlas Version vs MongoDB Driver version, so I tried installing the latest version, yet no success :frowning:

Would appreciate any help on this.
TIA :slight_smile:

Quite strange, but just noticed that uninstalling @google-cloud/vertexai dependency got things back to normal. But I really want @google-cloud/vertexai pacakge, so how do I get it to work ?
Why are @google-cloud/vertexai deps messing up with mongodb ?

Was able to fix it myself.
In my case, yarn.lock file seems to have been corrupted and deleting it and reinstalling all the packages solved the problem

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.