我有一个 AWS Step 函数,我需要将项目插入 DynamoDB。我将以下输入传递给 Step Function 执行:
{
"uuid": "dd10a857-3711-451e-91ee-d0b3ab621b2e",
"item_id": "0D98C2F77",
"item_count": 3,
"order_id": "IO-98255AX"
}
Run Code Online (Sandbox Code Playgroud)
我有一个 DynamoDB PutItem Step,设置如下:
由于item_count
是一个数值,我指定"N.$": "$.item_count"
- 我N
在开头指定,因为它映射到 DynamoDB 中的数字类型。由于所有其他字段都是字符串,因此我以 开始它们的键S
。
然后,我尝试使用上述有效负载测试 PutItem 步骤,但出现以下错误:
{
"error": "States.Runtime",
"cause": "An error occurred while executing the state 'DynamoDB PutItem' (entered at the event id #2). The Parameters '{\"TableName\":\"test_item_table\",\"Item\":{\"uuid\":{\"S\":\"dd10a857-3711-451e-91ee-d0b3ab621b2e\"},\"item_id\":{\"S\":\"0D98C2F77\"},\"item_count\":{\"N\":3},\"order_id\":{\"S\":\"IO-98255AX\"}}}' could not be used to start the Task: [The value for the field 'N' must be a …
Run Code Online (Sandbox Code Playgroud)