question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongooseError: Operation `inventories.find()` buffering timed out after 10000ms

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vkarpov15commented, Oct 6, 2021

You’re right @adamreisnz , the issue may very well be due to the poolSize option. We already got rid of the poolSize 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.

0reactions
IslandRhythmscommented, Oct 6, 2021
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found