I am currently facing a challenge with using the DynamoPutItem task to insert an entry that includes a list of objects as one of its attributes. I have searched online for examples of this but have not found any, leading me to question if it is even possible?
While looking into this, I came across an issue on the CDK GitHub repository that seems related, but the solutions discussed there do not seem to apply to my situation. I am curious if the approach mentioned there only works for lists of strings and not objects?
Below is a simplified example of the item structure I am attempting to insert into DynamoDB:
{
'someKey': 'This will be fine',
'anotherKey': [
{
'ohoh': 'This object and the list it belongs to will cause an error'
}
]
}
I have made numerous attempts using DynamoAttributeValue and JsonPath combinations without success. Here is an example of the code I have tried:
new DynamoPutItem(this, 'some id here', {
item: {
// this will be fine
someKey: DynamoAttributeValue.fromString(JsonPath.stringAt('$.someKey'),
// this will cause an error
anotherKey: DynamoAttributeValue.listFromJsonPath(JsonPath.stringAt('$.anotherKey')),
},
table: myTable,
}
Upon running this code, I encounter the following error:
The field "ohoh" is not supported by Step Functions