Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your retry logic is correct and does nothing

A comment on one of my posts sat open as an issue for two weeks before I understood how bad the thing it described actually was. The post was about an AI assistant missing the SQS trigger on a Lambda. Mads Hansen replied with a sentence I have not been able to unthink since: the trigger shape is the first contract, delivery and retry semantics are the second. Getting event.Records[0].body right…

The issue at hand concerns a Lambda function designed to process a batch of messages in Amazon SQS. Initially, the function appeared correct, as it correctly identified the failure of a single message within the batch, listing it in `batchItemFailures`. However, a deeper analysis revealed that the function's behavior was dependent on an external setting.

This setting controlled whether the function's partial batch response was actually reported or discarded by Lambda. If the setting was not explicitly set to `ReportBatchItemFailures`, the handler's output was ignored, leading to the entire batch being requeued, including the already processed messages. This resulted in duplicate processing, causing unnecessary work and potential financial losses due to double-charging customers.

The problem stemmed from a mismatch between the Lambda handler's code and the configuration of the event source mapping. The handler was designed correctly in terms of error handling and partial batch response logic, but the mapping for the trigger did not indicate that this behavior should be reported. This discrepancy led to the handler being perceived as correct by code reviewers, despite its failure to function as intended.

The solution lies in ensuring that the Lambda function and the event source mapping are aligned. The event source mapping must be configured to include `ReportBatchItemFailures` if the handler should report the partial batch response. This alignment ensures that the Lambda function behaves as expected, with only the failed item reported and the rest of the batch being deleted from the queue.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

NET::ERR_CERT_AUTHORITY_INVALID: When the Root Itself Is Not Trusted

The hostname matches. The chain is complete — every intermediate is present, each certificate signs the next, and it all leads up to a single certificate at the top. The dates are fine.

  • NET::ERRCERTAUTHORITYINVALID occurs when client refuses to trust root certificate.
  • Root certificate not recognized by client's trust store.
  • Causes include self-signed certs, private CAs, or untrusted roots.

Python 3.15 development features and performance updates

Python 3.15 is the next major step in the evolution of the world’s most popular programming language. Currently available as a release candidate, this version introduces lazy imports, a sampling…

  • Python 3.15 introduces lazy imports for faster startup time
  • Tachyon sampling profiler added for performance analysis
  • Frozendict immutable dictionary type enhances data safety

More from Monday 24 August →