MongooseError: Operation `inventories.find()` buffering timed out after 10000ms
See original GitHub issueI want to report a bug. This error occurs mainly in testing environments. When trying to update the database, This error appears intermittently:
[error] inventory: MongooseError: Operation `inventories.find()` buffering timed out after 10000ms
at Timeout.<anonymous> (/var/task/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:198:23)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
This is the connection code:
exports.createConnection = async (uri, app) => {
if (!connections[app]) {
let conn = await mongoose.createConnection(uri, {
appname: app,
// bufferCommands: false, // Disable mongoose buffering
// bufferMaxEntries: 0, // and MongoDB driver buffering
useNewUrlParser: true, // https://mongoosejs.com/docs/deprecations.html
useUnifiedTopology: true, // https://mongoosejs.com/docs/deprecations.html
poolSize: process.env.DB_POOL_SIZE && parseInt(process.env.DB_POOL_SIZE) || 50
})
conn.on('connected', () => {
// log.debug('OnConnected activeConnection', app)
// log.debug('OnConnected activeConnection', activeConnection)
})
conn.once("open", () => {
// log.debug('OnConnection OPEN ', app)
})
conn.on('error', (error) => {
// log.debug('OnError error', error)
})
conn.on('reconnected', () => {
// log.debug('Reconnected', app)
})
connections[app] = conn
activeConnection = conn
}
else {
// log.debug(`Found cached connection for, ${app}. Setting it to active`)
activeConnection = connections[app]
}
}
Connected listener never get hit.
Node version: 14.17.5 “mongodb”: “3.6.11” “mongoose”: “5.12.14”
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Operation `products.find()` buffering timed out after 10000ms ...
The issue on model.find() error: Operation products.find() buffering timed out after 10000ms" was resolved by removing the node_module ...
Read more >Mongoose error : buffering timed out after 10000ms #9732
MongooseError : Operation usermodels.insertOne() buffering timed out after 10000ms. I'm sure that my server is connected to the database.
Read more >MongooseError: Operation `users.insertOne()` buffering timed ...
User.find() is a Model.method() call, and it has a timeout. It is timing out probably because you're not connecting to the server, but...
Read more >Operation 'x.find()` buffering timed out after 10000ms
Solve "MongooseError: Operation 'x.find()` buffering timed out after ... uses a find() operation on the model it threw the following error.
Read more >“MongooseError: Operation `journals.aggregate()` buffering ...
MongooseError : Operation `books.find()` buffering timed out after 10000ms · Answers related to “MongooseError: Operation `journals.aggregate()` buffering timed ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’re right @adamreisnz , the issue may very well be due to the
poolSize
option. We already got rid of thepoolSize
option in our lambda docs: https://mongoosejs.com/docs/lambda.html and made a note in the 6.0 migration guide (https://mongoosejs.com/docs/migrating_to_6.html), so I think we can close this issue.@adamreisnz try
maxPoolSize
instead https://mongoosejs.com/docs/connections.html#connection_pools