Troubleshooting and Optimization
An SQS-triggered Lambda function has ReportBatchItemFailures enabled and records failed message IDs, but throws an exception after processing each batch containing a failure. Successfully processed messages are retried too. Which change fixes this behavior?
Show the answer
Correct answerA. Return the failed message IDs without throwing
AWhy this is right: Returning the required partial batch response allows Lambda to retry only the reported failed messages.
BWhy not this: A higher redrive threshold allows more retries without changing which messages are retried.
CWhy not this: A longer visibility timeout delays retries but does not prevent an exception from failing the entire batch.
DWhy not this: Maximum concurrency limits parallel processing; it does not change batch failure reporting.
With ReportBatchItemFailures enabled, the handler must return the failed message identifiers in the required response structure. Throwing an exception fails the entire batch; a longer visibility timeout only delays its retry.