Reputation: 489
I wrote a simple mongo test, trying to access mongo server in a vpc. for every run I get : "errorMessage": "*** Task timed out after 3.00 seconds" I have written more handlers in the lambda just to check it.
Thanks.
Upvotes: 5
Views: 5244
Reputation: 31
I had the same issue. The solution was to move the database connection object outside the handler method and cache/reuse it.
Here I added more details about it: https://stackoverflow.com/a/67530789/10664035
Upvotes: 1
Reputation: 1253
As weird as it may sound, we finally solved the problem just by changing the callback(null, response)
to context.done(null, response)
. This nonsense took us more time than we would have liked to spend here.
You can find more info about the issue here https://github.com/serverless/serverless/issues/1036
Upvotes: 4