Serverless Stream Processing with LambdaError handling in Lambda functions1 min

Lambda Event Source Mapping (ESM) triggers the designated Lambda function in a synchronous manner. This means that the ESM's invoking process waits for the function to respond before moving on to the next set of message batches. If an exception is raised within the function's code, the invoker process within ESM will retry sending the same message batch to the Lambda function. Currently, the messages will be retried until they expire, and there is no option to configure a retry threshold or to move malfunctioning messages (often called "poison pill" messages) to a dead letter queue.

To handle this situation effectively, the Lambda function needs to skillfully catch the exception using its application logic. Afterward, it can choose to either log the exception in CloudWatch or send it to a queue like SQS FIFO, providing an elegant way to manage errors and exceptions.

lambda-msk-error

For a more deep dive learning journey follow the Kafka Lambda learning guide.


Created by:

Mithun Mallick
Mithun MallickMithun Mallick is a Serverless Principal Solutions Architect at AWS.
Kevin Schwarz
Kevin SchwarzSolutions Architect, AWS
Naren Sithambaram
Naren SithambaramSolutions Architect, AWS
Prasanna S Krishnan
Prasanna S KrishnanSolutions Architect, AWS