Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4009

Some request on cached connection causes cursor session error in serverless enviroment

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: Lambda
    • Labels:
    • Not Needed

      What problem are you facing?

      We are developing a serverless application build on AWS Lambda. After upgrading driver to 4.x major version we have notice that only a few of about hundred of lambdas are failing because of

      Cursor session id (xxx) is not the same as the operation context's session id (none)

      We are initializing db connection outside of lambda handler as suggested here:

      https://docs.atlas.mongodb.com/best-practices-connecting-from-aws-lambda/

      The error occurs only on subsequent queries on the cached connection. What's more, we were observing it only in functions that do "heavy" queries, fetched lot of data from db.

      What driver and relevant dependency versions are you using?

      mongodb: 4.3.1

      Steps to reproduce?

      I was not able to reproduce it outside of lambda environment, however I've prepare a simple reproduction repository with one lambda function. If you follow the steps from README and deploy it to your AWS account, you will see errors in Cloud Watch logs quickly.

      https://github.com/dimitor115/mognodb-node-driver-cursor-error-reproduction

      I'm also attaching a logs from this reproduction lambda, where you can see the errors, logs also contains driver debug output.

            Assignee:
            Unassigned Unassigned
            Reporter:
            dimitor115@gmail.com Maciej Kopeć
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: