Recommendation: Should AWS provide a function for lambda timeout
I have worked extensively with AWS Serverless concepts in the Integration world. Services I use on daily basis include SQS, SNS, API Gateway, Lambda, etc.,
Since our application often acts as a bridge between multiple systems, one of the main challenges I often face is the performance issues with external systems. Becoz of these performance degradations, I often notice Lambda’s timing out. This will impact logging and the stats we use these logs to analyze.
I have tried multiple solutions to avoid lambda timeouts like processing a single message from SQS, setting lambda time to 15 mins(Max time), limiting lambda execution programmatically, etc. No solution worked out in our favor to rightly handle this issue.
AWS should come up with a new method(let's name it timeout_handler) similar to the event handler method. This timeout_handler should be invoked whenever lambda gets timed out, this gives the users flexibility to write simple code to add a log or do some action that feels right to the users/organizations.