Hi,
I am getting a warning consistently each time our webserver or another process connects to the DB.
(node:24990) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:650:11)
at Object.get (internal/modules/cjs/loader.js:664:5)
at Object.<anonymous> (/home/my-user/my-project/node_modules/mongodb/lib/operations/operation.js:4:38)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/modules/cjs/helpers.js:88:18)
Some extra information:
- The process that tries to connect is started via PM2
- The connection is established and works, this is only a warning, not a crash
- Driver mongodb for nodejs, version 3.6.2
- It only happens on one of our environments. The only unique thing about this environment is that it connects to mongoDB using VPC peering (the others do not: they do not get this warning)
- The server is hosted on an AWS EC2, and we use MongoDB Atlas hosted on AWS as cloud provider as well
I googled for this error and encountered similar errors. Those were solved by Mongodb in a newer version of the driver. So it seems to me this is also an issue with the driver itself, and not our code.
Thanks in advance.