-
Type: Bug
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: None
-
Component/s: Lambda
-
Empty show more show less
-
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.