Closed syedahmedhaidershah closed 1 year ago
I think I understand what you're describing, but I don't believe serverless-http is causing this, it is a bug in your code or some kind of pooling behaviour on mongoose. If you share code, I can give a more specific response.
Hey @dougmoscrop we looked into it deeper, popped up in our EC2 Auto-scaling groups too (where we are not even using serverless).
It is an issue in fact, an issue with Mongoose.
Closing this 😊 Thanks man
Hi, I noticed this issue while using Mongoose.
PS my issue IS NOT related to Mongoose. While using serverlessHTTP, my Mongoose connection initialized outside the handler, though for some reason when I use it inside the handler creates a new connection.
Somehow ServerlessHTTP creates a new namespace for the function state.
It destroys the Singleton pattern of Mongoose.
REF: https://www.mongodb.com/docs/atlas/manage-connections-aws-lambda/#std-label-lambda-aws-example