Netlify lambda & MongoDB time out


I am quite new to Netlify. I am having a problem with MongoDB (specifically with atlas DB) and functions. Whenever I make a request to an endpoint that accesses the database, it times out after 10 seconds. This was not a problem when I was developing/testing it locally. I am aware that this is the maximum for functions level 0. I have also set the whitelisted IP to Other functions that do not use/access the database work just fine. I just wanted to confirm whether the starting connection just takes a long time or something might be wrong with my code.

Thank you!

Hey @andrewing!
It’s very possible that your function is not able to complete its work in 10 seconds, or it needs more memory than is available.

Functions timeout after 10 seconds, and are limited to 1024mb (1 gb) of memory by default. They are deployed to AWS Lambda in their us-east-1 region. Some modules, for example, Headless Chrome , require the whole 1gb of RAM! There are custom settings available (up to 26 seconds runtime and 3Gb memory) which you’ll need to contact our support team - please post in the #admin area of this forum to get our attention for this.

Can you check your function logs and see if there’s any information there about duration or memory usage? Those will be here:

Also wanted to share this post on MongoDB in case it’s helpful for you: