Hi all, I'm seeing some odd behavior. I have two lambda functions which connect to my MongoDB Atlas instance. I've looked at all the past messages about MongoDB connection re-use between invocations of the same lambda function and believe I have it set up correctly. My code works like this:
Lambda Function 1 is connected to an API endpoint and spawns several invocations of Lambda Function 2, which completes some trivial database calls and parsing (~300 ms excluding Mongo connection time)
The behavior I'm seeing is that Lambda Function 2 does not re-use any mongo connection on the first invocation (this connection is also taking an abnormally long time (> 10 seconds)) and times out. A minute later, I can see that the invocation is retried automatically and does not re-use the mongo connection and also times out after 10 seconds. Then two minutes, later, the function is retried a third time, which re-uses the mongo connection and completes in 300ms.
Any ideas here on what could be going on?