【问题标题】:AWS SDK v3 TransactWriteItemsCommand TypeError: Cannot read property '0' of undefinedAWS SDK v3 TransactWriteItemsCommand TypeError:无法读取未定义的属性“0”
【发布时间】:2022-05-05 21:42:07
【问题描述】:

我正在尝试使用 TransactWriteItemsCommand 来使用适用于 NodeJS 的新 AWS 开发工具包 V3。不幸的是,我找不到示例,并且文档还没有很好的记录。

这是我的参数对象:

    {
        "TransactItems": [
            {
                "Update": {
                    "TableName": "boxes",
                    "Key": {
                        "id": "36"
                    },
                    "UpdateExpression": "set isOpen = :isOpen",
                    "ExpressionAttributeValues": {
                        ":isOpen": {
                            "BOOL": true
                        }
                    }
                }
            },
            {
                "Update": {
                    "TableName": "boxes",
                    "Key": {
                        "id": "33"
                    },
                    "UpdateExpression": "set isOpen = :isOpen",
                    "ExpressionAttributeValues": {
                        ":isOpen": {
                            "BOOL": true
                        }
                    }
                }
            }
        ]
    }

我做错了什么?任何帮助将不胜感激!

【问题讨论】:

    标签: node.js amazon-web-services transactions sdk


    【解决方案1】:

    感谢@flanamacca 提供answer

    问题在于密钥的格式,因为我没有使用 DynamoDB JSON 格式。

       "Key": {
        "id": {"S": "36"}
       },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-26
      • 1970-01-01
      相关资源
      最近更新 更多