AWS Lambda Connection Limits

I have been using AWS Lambda and Atlas for two years. Best practices, reusing connection between invocations, etc. etc.

NodeJS = 14.x
Atlas MongoDB = 4.4.8
Mongodb Node Driver = 4.1.0
Mongoose = 5.13.5

Recently the number of connections have skyrocketed. The useUnifiedTopology: true setting seems to be causing new connections on existing warm containers. I.e. the connection is lost, even after just 5 seconds if no activity, for the same warm container.

If I set useUnifiedTopology to false, the issue goes away, however new connections sometimes time out.

Has anyone else experienced this issue?

Sorry to hear that you’re suddenly having connection issues. We’d love to help in the context of your Atlas cluster. Would you be able to create an in-app support chat session or open a support case? Please link to this forum topic and feel free to ask specifically for me (Angela). This way we’ll also be able to see historical connection counts for your Atlas cluster.

Couple of initial thoughts - It would be helpful to see your package.json file, as it looks like Mongoose 5.13.5 uses Node driver version 3.6.10 and not Node driver version 4.2.1. Also, we do recommend keeping useUnifiedTopology: true (Best Practices Connecting from Lambda to Atlas).

Kind regards,
Angela@MongoDB

1 Like

Thanks for the reply. Yes it seems it is indeed the Mongoose driver being used.