fix(stepfunctions): properly deprecate DistributedMap resultWriter property#36000
Open
fix(stepfunctions): properly deprecate DistributedMap resultWriter property#36000
Conversation
- Mark `resultWriter` as deprecated in `DistributedMapBaseOptions` - Add validation error when `resultWriter` is used - Update documentation to clarify that `resultWriter` does not function correctly - Recommend using `resultWriterV2` instead of deprecated `resultWriter` - Update test cases to validate new deprecation behavior This change ensures users are guided towards using the correct result writer configuration for Distributed Map states in AWS Step Functions.
aws-cdk-automation
previously requested changes
Nov 10, 2025
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Contributor
|
|
||||||||||||||
Contributor
|
|
||||||||||||||
…e resultWriterV2 ?? resultWriter Remove the FeatureFlags dependency from getResultWriter() and use a simple resultWriterV2 ?? resultWriter fallback. This fixes resultWriterV2 not rendering inside CDK Stages where FeatureFlags.of(this).isEnabled() returns false even when the flag is set to true. - resultWriterV2 is always preferred when provided - Falls back to resultWriter for backward compatibility - Emits a deprecation warning when resultWriter is used Closes aws#35966
3feb769 to
b81dae8
Compare
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.
Issue # (if applicable)
Closes #35966.
Reason for this change
The
getResultWriter()method inDistributedMapgates on the@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2feature flag to decide which writer to return. This causes two problems:resultWriteris provided → returnsundefined(silent data loss)resultWriterV2is never selected, even when explicitly providedAs reported by @aihaddad in #35966 (comment),
FeatureFlags.of(this).isEnabled()returnsfalseinside a Stage even when the flag is set totrue.Evidence
Official AWS docs confirm the expected ASL output — ResultWriter (Map) specifies that
ResultWritermust containResource+Parameters(JSONPath) orResource+Arguments(JSONata) to export results to S3. The CDK bug causes this entire block to be silently omitted.Description of changes
Removed the feature flag gate from
getResultWriter()and replaced it with a simple fallback:resultWriterV2is always preferred when providedresultWriterfor backward compatibilityresultWriteris usedHow it works
Before (broken):
After (fixed):
Describe any new or updated permissions being added
N/A
Description of how you validated changes
resultWriterV2renders regardless of feature flag stateresultWriterrenders with deprecation warningresultWriterV2takes precedence when both are providedresultWriterV2Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license