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-cdk-lib: DynamoAttributeValue.booleanFromJsonPath synthesizes incorrectly #31448

Open
1 task
klaframboise opened this issue Sep 15, 2024 · 3 comments
Open
1 task
Labels
aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. p3

Comments

@klaframboise
Copy link

klaframboise commented Sep 15, 2024

Describe the bug

DynamoAttributeValue.booleanFromJsonPath synthesizes to invalid CloudFormation template. Attempting to deploy code that includes DynamoAttributeValue.booleanFromJsonPath results in the following error:

Resource handler returned message: "Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Cannot deserialize value of type `java.lang.Boolean` from String "$.inputValue": only "true" or "false" recognized at /States/PutItemWithBooleanFromJsonPath
/Parameters' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition; Request ID: 4c7586b2-e138-49ed-9e3c-fe39f47658c1; Proxy: null)" (RequestToken: 25db2a45-bbb6-4977-aa96-0a46f77d25c2, HandlerErrorCode: InvalidRequest)

Regression Issue

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

Last Known Working CDK Version

No response

Expected Behavior

  • Code using DynamoAttributeValue.booleanFromJsonPath can be deployed.
  • DynamoAttributeValue.booleanFromJsonPath synthesizes correctly to
{"BOOL.$":"$.inputValue"}

Current Behavior

  • Code using DynamoAttributeValue.booleanFromJsonPath cannot be deployed.
  • DynamoAttributeValue.booleanFromJsonPath synthesizes to
{"BOOL":"$.inputValue"}

Reproduction Steps

The deployment should fail with the following error:

8:49:26 PM | CREATE_FAILED        | AWS::StepFunctions::StateMachine | BooleanFromJsonPathIssueDemo
Resource handler returned message: "Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Cannot deserialize value of type `java.lang.Boolean` from String "$.inputValue": only "true" or "false" recognized at /States/PutItemWithBooleanFromJsonPath
/Parameters' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition; Request ID: 4c7586b2-e138-49ed-9e3c-fe39f47658c1; Proxy: null)" (RequestToken: 25db2a45-bbb6-4977-aa96-0a46f77d25c2, HandlerErrorCode: InvalidRequest)

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.158.0 (build 4b8714d)

Framework Version

No response

Node.js Version

v20.14.0

OS

Ubuntu-22.04 (WSL)

Language

TypeScript

Language Version

No response

Other information

No response

@klaframboise klaframboise added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 15, 2024
@github-actions github-actions bot added aws-cdk-lib Related to the aws-cdk-lib package potential-regression Marking this issue as a potential regression to be checked by team member labels Sep 15, 2024
@klaframboise klaframboise changed the title aws-cdk-lib: DynamoAttributeValue.booleanFromJsonPath aws-cdk-lib: DynamoAttributeValue.booleanFromJsonPath synthesizes incorrectly Sep 15, 2024
@pahud
Copy link
Contributor

pahud commented Sep 15, 2024

You checked the potential regression issue checkbox, can you specify Last Known Working CDK Version as well? It would be very helpful to help us identify if it's a regression and take actions for that. Thank you.

@pahud pahud added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 15, 2024
@pahud
Copy link
Contributor

pahud commented Sep 15, 2024

Also I noticed the provided link is having empty code.

https://github.com/klaframboise/cdk-booleanFromJsonPath-issue/blob/448364b680f9cd396d0adb22bd7d9b577256c8ba/lib/boolean_from_json_path_issue-stack.ts#L5-L16

Are you able to provide minimal reproducible code snippets for us? Thank you.

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 and removed needs-triage This issue or PR still needs to be triaged. potential-regression Marking this issue as a potential regression to be checked by team member labels Sep 15, 2024
@klaframboise
Copy link
Author

klaframboise commented Sep 15, 2024

Sorry about the missing code in the sample, it should be fixed now: https://github.com/klaframboise/cdk-booleanFromJsonPath-issue/blob/main/lib/boolean_from_json_path_issue-stack.ts

I've checked the regression box because I guess the alternative is that it was implemented but it never worked given how simple it is to repro... but I'll uncheck it since I don't know when it was last working, this is my first time trying it.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. p3
Projects
None yet
Development

No branches or pull requests

2 participants