Skip to content

fix(parser): accept non-string DynamoDB tumbling window state - #6001

Merged
dreamorosi merged 2 commits into
aws-powertools:mainfrom
Manishram-ai:fix/parser-dynamodb-tumbling-window-state
Nov 18, 2026
Merged

dreamorosi merged 2 commits into
aws-powertools:mainfrom
Manishram-ai:fix/parser-dynamodb-tumbling-window-state

Conversation

@Manishram-ai

Copy link
Copy Markdown
Contributor

Summary

DynamoDBStreamSchema only accepted strings in the tumbling window state, but Lambda passes back whatever state the function returned, and the Lambda docs use numbers there. The schema now accepts any value, the same as KinesisDataStreamSchema.

Changes

  • state in DynamoDBStreamSchema is now z.record(z.string(), z.unknown()), so the inferred DynamoDBStreamEvent['state'] type changes from Record<string, string> to Record<string, unknown>.
  • A new unit test parses a tumbling window event with the numeric state from the Lambda docs. It fails on main with Invalid input: expected string, received number and passes with this change.
  • npm run test:unit:coverage, npm run lint, npm run build:tests and npm run test:unit:types pass in packages/parser, and coverage stays at 100%.

Issue number: closes #5999


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.

@dreamorosi dreamorosi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for fixing this!

@dreamorosi
dreamorosi enabled auto-merge (squash) November 18, 2026 15:12
@dreamorosi
dreamorosi merged commit 25f8820 into aws-powertools:main Nov 18, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR between 10-29 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: DynamoDBStreamSchema rejects tumbling window events when the state has non-string values

2 participants