fix(cli-internal): read DynamoDB event source properties from CFN template#14895
Open
adrianjoshua-strutt wants to merge 2 commits into
Open
fix(cli-internal): read DynamoDB event source properties from CFN template#14895adrianjoshua-strutt wants to merge 2 commits into
adrianjoshua-strutt wants to merge 2 commits into
Conversation
…plate Extract StartingPosition and BatchSize from EventSourceMapping CFN resources instead of hardcoding LATEST. This allows the generated code to preserve the original trigger configuration (e.g., TRIM_HORIZON, custom batch sizes). --- Prompt: Fix dynamo trigger props to read from CFN template instead of hardcoding LATEST.
32acee1 to
7ea9a12
Compare
Generate separate addEventSource statements per DynamoDB trigger model instead of a single for-of loop that incorrectly used triggers[0].props for all models. This ensures each model gets its own StartingPosition and BatchSize from the CFN EventSourceMapping resource. Also adds 3 unit tests: - Single trigger with custom BatchSize and StartingPosition - Multiple triggers with different configs (proves the bug is fixed) - Fallback to LATEST when StartingPosition is missing from CFN
sarayev
previously approved these changes
May 19, 2026
Contributor
sarayev
left a comment
There was a problem hiding this comment.
Do we need to implement tests for those changes?
soberm
previously approved these changes
May 19, 2026
Member
Author
|
@sarayev I added tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When generating Lambda DynamoDB stream trigger wiring, the tool hardcoded
StartingPositiontoLATESTand ignoredBatchSizefrom the Gen1 CloudFormation template'sAWS::Lambda::EventSourceMappingresources. This meant customers usingTRIM_HORIZONor custom batch sizes had their configuration silently discarded during migration.Fixes #14569.
Solution
Detection changes
detectDynamoTriggerModelsanddetectStorageDynamoTriggersnow returnDetectedDynamoTrigger[](carrying both the model/table name and the extracted properties) instead of plainstring[].Contribution changes
contributeDynamoTriggerandcontributeStorageDynamoTriggerconsume the new typed triggers and emit the correctStartingPositionand optionalbatchSizein the generatedDynamoEventSourceconstructor.Helpers
extractDynamoTriggerProps(): safely readsStartingPosition(default:LATEST) andBatchSize(omitted when absent) from CFN Properties.createDynamoEventSourceProps(): builds the TypeScript object literal property assignments for the CDK constructor.Testing
discussionssnapshot app to include the newly emittedbatchSize: 100(present in its CFN template).