Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws_stepfunctions): Depreciated Parameters field in Map #23265

Closed
2 tasks
grzegorzewald opened this issue Dec 7, 2022 · 9 comments · Fixed by #28771
Closed
2 tasks

(aws_stepfunctions): Depreciated Parameters field in Map #23265

grzegorzewald opened this issue Dec 7, 2022 · 9 comments · Fixed by #28771
Assignees
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@grzegorzewald
Copy link

Describe the feature

As per https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html#map-state-inline-deprecated-fields, Parameters filed is now depreciated. ItemSelector field should be used instead (https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html#itemselector)

Use Case

Depreciated fields may break compatibility

Proposed Solution

As new ItemSelector filed takes input in exactly the same form as depreciated 'Parameters', the easiest solution would be to rename field and create "alias" with depreciation warning durning synth.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.53.0

Environment details (OS name and version, etc.)

MacOS 13.0.1

@grzegorzewald grzegorzewald added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 7, 2022
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label Dec 7, 2022
@peterwoodworth
Copy link
Contributor

To be clear, you're referring to this parameter which will end up rendering like this?

@peterwoodworth peterwoodworth added p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Dec 7, 2022
@grzegorzewald
Copy link
Author

Hi @peterwoodworth,
Yes, exactly this one.

@shantgup
Copy link

shantgup commented Feb 8, 2023

My customer is trying to use ItemSelector with CDK, only to find that Map does not support ItemSelector.

I have suggested them to use the deprecated Parameters field for now.

The documentation here states that it's highly recommended to use ItemSelector instead of Parameters, but CDK users will not be able to follow this recommendation due to missing support for ItemSelector in the CDK construct.

The ItemSelector field replaces the Parameters field within the Map state. If you use the Parameters field in your Map state definitions to create custom input, we highly recommend that you replace them with ItemSelector.

@peterwoodworth peterwoodworth added effort/medium Medium work item – several days of effort and removed effort/small Small work item – less than a day of effort labels Feb 8, 2023
@MorelSerge
Copy link

Been a bit disappointed with the supported of Map in the CDK in general. First tried to find a way to use distributed mode: node supported, using ItemSelector as the alternative -> also not supported :/

@7jpsan
Copy link

7jpsan commented Jul 18, 2023

Hi, @grzegorzewald probably not canonical (but a workaround) but I had a similar issue and while we wait the native cdk class Map support for it, we can use a CustomState based off the MapState and tweak a couple props:

const mapState = new sfn.CustomState(this, 'MapWithSelector', {
            stateJson: {
                ...new sfn.Map(this, 'Irrelevant', {
                    itemsPath: sfn.JsonPath.stringAt('$.parallelInputData'),
                })
                    .iterator(yourIteratorGoesHere)
                    .toStateJson(),
                End: undefined,
                ItemSelector: {
                    'ContextIndex.$': '$$.Map.Item.Index',
                    'ContextValue.$': '$$.Map.Item.Value',
                },
            },
        });

This will create the Map state with the ItemSelector on it.

@T-Guerrero
Copy link

IMO, this request shouldn't be labeled as "feature request". It's actually an inconsistency with the official doc, thus "bug" looks a better classification for me (even for prioritization purposes)

@joa44741
Copy link

would also love to use the ItemSelector instead of Parameters :)

@guyernest
Copy link

From the Step Functions Documentation for Map (https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html) under the Deprecated fields:

Note
Although you can continue to include Map states that use the following fields, we highly recommend that you replace Iterator with ItemProcessor and Parameters with ItemSelector.

The current map.iterator implementation ignores this note, and there is no support for the recommended definition.

The only way around it is to use the custom tast option.

@mergify mergify bot closed this as completed in #28771 Jan 22, 2024
mergify bot pushed a commit that referenced this issue Jan 22, 2024
Adds support for Map's [ItemSelector](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html) field and deprecates [parameters](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html#map-state-inline-deprecated-fields).

With the release of Distributed Maps, AWS StepFunctions has released a few new fields, and deprecated two old ones for Map states. One of them was `Iterator` which was replaced with `ItemProcessor`, the other one is `Parameters` (replaced by `ItemSelector`). A similar PR was made to deprecate `Iterator` (#27913). While they are deprecated, these fields are still supported (PR reflects that)

`ItemProcessor` and `ItemSelector` are both fields that are supported in `DISTRIBUTED` and `INLINE` mode, hence why they were added to the existing Map construct

Closes #23265

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
9 participants