繁体   English   中英

AWS CDK 步骤 Function 任务 - 在 DynamoPutItem 任务中包含对象列表

[英]AWS CDK Step Function Task - Include list of objects in DynamoPutItem task

我正在尝试使用DynamoPutItem任务来放置一个条目,其中包含一个对象列表作为其属性之一。 我找不到任何在线完成此操作的示例,所以我想知道是否有可能?

这个 CDK问题似乎在谈论同样的事情,但这对我不起作用,我想知道它只适用于字符串列表而不是对象吗?

这是我尝试放入 DDB 的项目的简化示例:

{
  'someKey': 'This will be fine',
  'anotherKey': [
    {
      'ohoh': 'This object and the list it belongs will cause an error'
    }
  ]
}

我尝试了DynamoAttributeValueJsonPath的多种组合都无济于事:(

这是我尝试过的一些代码的示例:

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,
}

及其抛出的错误: The field "ohoh" is not supported by Step Functions

如果我在这里阅读文档,您似乎需要使用:

DynamoAttributeValue.listFromJsonPath(value: anotherKey)

你有没有找到解决方案? 我遇到了同样的问题......

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM