I have two node.js projects in a single repo. Parent project has the mongoose schemas, services, and all other business services.
The projects start with chained command.
node -r dotenv/config src/app.js & **(cd chat && node index.js)**
So, they start at the same time on different ports.
I’ve been trying to access DB from child node.js project but it returns the following error:
MongooseError: Operation `users.findOne()` buffering timed out after 10000ms
at Timeout.setTimeout (/root/projects/project_name/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:20)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
I don’t want to create an endpoint on the parent project because I will transport sensitive information between the two projects. Also, I don’t want to use MongoClient as a provider, either.
Any idea how we can fix this issue or trace the root cause? Thx..