Skip to content

(aws-stepfunctions): Can't add Jsonata strings to toleratedFailurePercentage #34085

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

Open
1 task
NikHammon opened this issue Apr 9, 2025 · 1 comment
Open
1 task
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. p2

Comments

@NikHammon
Copy link

Describe the bug

When trying to create a DistributedMap with a jsonata string passed in for the toleratedFailurePercentage it is not typesafe and I get a validation error saying that it must be a number that prevents me from generating the definition that I want.

I have tried uploading a jsonata string to the definition body in the aws console so I know its allowed and the doc agree.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

I would expect that I am allowed to use a jsonata variable string for the distributed map failure threshold as specified in the doc.

Current Behavior

Error: Validation failed with the following errors:
  [.../Map] toleratedFailurePercentage must be between 0 and 100

Reproduction Steps

const map = DistributedMap.jsonata(this, 'Map', {
      stateName: 'My map',
      items: ProvideItems.jsonata(...),

      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      // @ts-ignore
      toleratedFailurePercentage: '{% $myThreshold %}', <<-- This causes a validation error
    })

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

^2.178.1

Framework Version

No response

Node.js Version

v20.18.2

OS

OSX

Language

TypeScript

Language Version

No response

Other information

No response

@NikHammon NikHammon added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 9, 2025
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label Apr 9, 2025
@pahud pahud self-assigned this Apr 9, 2025
@pahud
Copy link
Contributor

pahud commented Apr 9, 2025

Thanks for raising this issue.

After investigation, the root cause is that the DistributedMap construct in AWS CDK does not currently support passing a Jsonata expression to dynamically set the tolerated failure percentage.

Details:

  • The DistributedMap API only accepts a static number for toleratedFailurePercentage.
  • The toleratedFailurePercentagePath property, which allows dynamic values, is only supported in JSONPath mode, not in Jsonata mode.
  • Attempting to pass a Jsonata string like '{% $myThreshold %}' results in a validation error or is ignored.

Expected Behavior:

Since AWS Step Functions supports Jsonata expressions for this field in the ASL definition, the CDK should ideally allow users to specify a Jsonata expression dynamically.

Recommendation:

Enhance the CDK DistributedMap construct to support:

  • Passing a Jsonata expression for tolerated failure percentage, either by:
    • Extending toleratedFailurePercentagePath to accept Jsonata strings in Jsonata mode, or
    • Introducing a new property such as toleratedFailurePercentageExpression.

This would align the CDK API with Step Functions capabilities and enable dynamic, data-driven workflows.


Making this a p2 feature request. Please add 👍 to help us prioritize and we welcome PRs as well.

Thanks!

@pahud pahud removed their assignment Apr 9, 2025
@pahud pahud added p2 feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 9, 2025
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. p2
Projects
None yet
Development

No branches or pull requests

2 participants