Return partial batch failures from an SQS-triggered Lambda function using ReportBatchItemFailures instead of failing the whole batch

domain: aws-lambda · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Update the event source mapping to include ReportBatchItemFailures in FunctionResponseTypes, e.g. `aws lambda update-event-source-mapping --uuid <uuid> --function-response-types ReportBatchItemFailures`
  2. In the function, process each record and collect the message IDs that failed
  3. Return {"batchItemFailures": [{"itemIdentifier": "<message-id>"}, ...]} — an empty list, null, or empty response means the whole batch succeeded
  4. For a standard queue, only the listed failed message IDs become visible again for redelivery; successfully processed ones are not retried
  5. For a FIFO source queue, stop processing at the first failure and report that message plus every subsequent unprocessed message as failed, to preserve ordering
  6. Validate the response shape carefully — malformed JSON, an empty-string or null itemIdentifier, a bad key name, or an ID not present in the batch all cause AWS to treat the entire batch as failed

Known gotchas

Related routes

tune an sqs-to-lambda event source mapping's batching window and concurrency for cost and latency trade-offs
docs.aws.amazon.com · 5 steps · unrated
Handle partial failures in Google Ads API batch mutate operations
developers.google.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans