aws / aws/aws-cdk

aws-cdk-lib: DynamoAttributeValue.booleanFromJsonPath synthesizes incorrectly

Open
#31,448 3 comments 0 reactions 1 assignee Claimed by @pahud View on GitHub
aws-cdk-lib bug p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### 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

* Clone this repository https://github.com/klaframboise/cdk-booleanFromJsonPath-issue
* Run `cdk deploy`

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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.