gpt4 book ai didi

amazon-web-services - DynamoDB updateItem 失败

转载 作者:行者123 更新时间:2023-12-01 10:36:35 26 4
gpt4 key购买 nike

尝试创建 Lambda 以从 Kinesis 流更新 DynamoDB。这是我的更新声明:

var response = dd.updateItem({
'Key': {'S': payload.identityId},
'TableName': 'Users',
'UpdateExpression': 'SET testVal = :testVal',
'ExpressionAttributeValues': {
':testVal': {'S': 'This is a test'}
}
}

生成 47 条错误消息:

  • InvalidParameterType:预期 params.Key['S'] 是一个结构

  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“0”

  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“1”
  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“2”
  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“3”

...

  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“44”
  • UnexpectedParameter:在 params.Key['S'] 中发现意外的键“45””

Users 表存在并且当前为空。我仔细检查了 identityID 是否存在(并且有效)。任何人都可以看到我在这里做错了什么吗?

最佳答案

想通了。有时只是发布问题会让您有不同的想法!

我没有正确传递 Key

dd.updateItem({
'Key': {
'hashAttributeName': {
'S': payload.identityId
}
},
'TableName': 'Users',
'UpdateExpression': 'SET testVal = :testVal',
'ExpressionAttributeValues': {
':testVal': {'S': 'This is a test'}
}
}

关于amazon-web-services - DynamoDB updateItem 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34356856/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com