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: JsonPath.arrayContains errors when checking for booleans #27722

Closed
Pharrox opened this issue Oct 27, 2023 · 2 comments
Closed
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@Pharrox
Copy link

Pharrox commented Oct 27, 2023

Describe the bug

Using JsonPath.arrayConains throws an error when trying to check if an array contains a boolean value because the inner function for rendering expressions doesn't account for boolean values:

JsonPath.arrayContains(JsonPath.entirePayload, true);

Expected Behavior

Renders the intrinsic function as;

States.ArrayContains($, true)

Current Behavior

Throws the error:

Error: Unxexpected value.
    at renderInExpression (./aws-cdk-lib/aws-stepfunctions/lib/private/json-path.js:1:5194)
    at Array.map (<anonymous>)
    at Function.arrayContains (./node_modules/aws-cdk-lib/aws-stepfunctions/lib/fields.js:1:2527)
...

Reproduction Steps

Run anywhere in a Typescript CDK app:

JsonPath.arrayContains(JsonPath.entirePayload, true);

Possible Solution

Update renderInExpression to be able to identify and output boolean values.

Probably along the lines of adding:

if (typeof x === 'boolean') return x.toString();

Additional Information/Context

Could probably occur in other intrinsic functions. Any intrinsics that uses renderInExpression seems like it would suffer from this problem.

CDK CLI Version

2.102.1 (build 8e4485b)

Framework Version

2.102.1

Node.js Version

v18.16.0

OS

Fedora 34 (Workstation Edition)

Language

TypeScript

Language Version

4.9.5

Other information

No response

@Pharrox Pharrox added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 27, 2023
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label Oct 27, 2023
@pahud
Copy link
Contributor

pahud commented Oct 31, 2023

Thank you for your report. Are you able to provide a minimal reproducible CDK app that we can run in our account?

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 31, 2023
Copy link

github-actions bot commented Nov 2, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 2, 2023
@github-actions github-actions bot closed this as completed Nov 7, 2023
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 bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants