Using MongoDB Atlas on Lambda throws Could not connect to any servers in MongoDB Atlas cluster error

Hi @Shawn_Varughese and welcome in the MongoDB Community :muscle: !

Are you creating a new connection (==mongoClient) for each Lambda or your MongoDB Connections are shared across multiple (all) lambdas?

I give you a little hint, “yes” is a very bad answer :wink: !

Check out this doc where they explain how to set up the connection correctly:

Using a private endpoint would also be a plus (instead of 0.0.0.0/0).

Cheers,
Maxime.