aws / aws/aws-cdk

aws_stepfunctions_tasks: DynamoAttributeValue.fromStringSet requires an array

Open
#25,693 5 comments 0 reactions 1 assignee Claimed by @scanlonp View on GitHub
@aws-cdk/aws-stepfunctions-tasks bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When creating a JsonPath value, it returns a string even for arrays, but DynamoAttributeValue.fromStringSet needs a string array.

```
const releaseSlot = new DynamoUpdateItem(this, "ReleaseSlot", {
key: {
[partitionKey]: DynamoAttributeValue.fromString(fixedKey),
},

updateExpression: `DELETE ${workflowsKey} :val`,
expressionAttributeValues: {
":val": DynamoAttributeValue.fromStringSet(
JsonPath.array(
JsonPath.stringAt("$$.Execution.Id")
) as unknown as string[]
),
},
table: slots,
});
```

### Expected Behavior

This should work without the `as unknown as string[]` cast

### Current Behavior

`as unknown as string[]` cast is required

### Reproduction Steps

The code above without the cast will cause the TypeScript error.

### Possible Solution

Accept a `string` or `string[]`. This would be non-breaking.

### Additional Information/Context

_No response_

### CDK CLI Version

2.80.0

### Framework Version

_No response_

### Node.js Version

16.14.2

### OS

Mac

### Language

Typescript

### Language Version

5.0.4

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