Skip to content

Conversation

@exg
Copy link
Contributor

@exg exg commented Dec 16, 2025

Issue number: closes #7817

Summary

Data model for DynamoDB Stream Lambda Invocation records

Changes

This commit adds a model for the invocation record that a Lambda with a DynamoDB event source sends to a SNS, SQS or S3 destination for failed invocations. The record format is described in

https://docs.aws.amazon.com/lambda/latest/dg/services-dynamodb-errors.html

The model can be used in the handler of a lambda that processes failed invocations from SNS or SQS by combining it with the source envelope model, e.g.,

from aws_lambda_powertools.utilities.parser import envelopes, event_parser
from aws_lambda_powertools.utilities.parser.models import DynamoDBStreamLambdaInvocationModel

@event_parser(model=DDBStreamInvocationModel, envelope=envelopes.SqsEnvelope)
def lambda_handler(event: list[DDBStreamInvocationModel], context: LambdaContext):
    ...

User experience

Please share what the user experience looks like before and after this change


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@exg exg requested a review from a team as a code owner December 16, 2025 09:33
@exg exg requested a review from hjgraca December 16, 2025 09:33
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation tests labels Dec 16, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 16, 2025
@svozza
Copy link

svozza commented Dec 16, 2025

Thank you for creating this issue and the accompanying PR! We will review your PR shortly.

This commit adds a model for the invocation record that a Lambda with
a DynamoDB event source sends to a SNS, SQS or S3 destination for
failed invocations. The record format is described in

https://docs.aws.amazon.com/lambda/latest/dg/services-dynamodb-errors.html

The model can be used in the handler of a lambda that processes failed
invocations from SNS or SQS by combining it with the source envelope
model, e.g.,

  from aws_lambda_powertools.utilities.parser import envelopes, event_parser
  from aws_lambda_powertools.utilities.parser.models import DynamoDBStreamLambdaOnFailureDestinationModel

  @event_parser(model=DynamoDBStreamLambdaOnFailureDestinationModel, envelope=envelopes.SqsEnvelope)
  def lambda_handler(event: list[DynamoDBStreamLambdaOnFailureDestinationModel], context: LambdaContext):
      ...
@exg exg force-pushed the dynamodb-stream-lambda-invocation-record branch from d7e1c79 to c686394 Compare December 16, 2025 11:59
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 16, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.53%. Comparing base (16748c9) to head (ff9d5f3).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7818      +/-   ##
===========================================
+ Coverage    96.49%   96.53%   +0.03%     
===========================================
  Files          275      275              
  Lines        13123    13151      +28     
  Branches       990      990              
===========================================
+ Hits         12663    12695      +32     
+ Misses         355      353       -2     
+ Partials       105      103       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVED!

@leandrodamascena leandrodamascena merged commit f309012 into aws-powertools:develop Dec 16, 2025
16 checks passed
@exg exg deleted the dynamodb-stream-lambda-invocation-record branch December 16, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

Status: Coming soon

Development

Successfully merging this pull request may close these issues.

Feature request: data model for DynamoDB Stream Lambda invocation records

3 participants