使用javascript aws sdk
我的表定义如下:
resources:
Resources:
ImagesTable:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
- AttributeName: "deviceId"
AttributeType: "S"
- AttributeName: "timeStamp"
AttributeType: "N"
KeySchema:
- AttributeName: "deviceId"
KeyType: "HASH"
- AttributeName: "timeStamp"
KeyType: "RANGE"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.settings.${self:custom.myStage}.ITEMS_DYNAMODB_TABLE}
StreamSpecification:
StreamViewType: NEW_IMAGE
我尝试运行查询并获取所有与字符串匹配的设备。
我的params对象是
const params: DynamoDB.DocumentClient.GetItemInput = {
TableName: eventLogTable,
Key: {deviceId: 'device12345'}
};
我的电话是
return this.client.get(params).promise()
.then(result => {
return result;
});
在日志文件中,我看到以下错误:
2019-06-21T17:23:27.878Z cc865442-8604-4f5c-8099-72eba87d9b2b query params right before going in { TableName: 'sls-basic-operations-items-dev',
Key: { deviceId: 'device12345' } }
2019-06-21T17:23:27.904Z cc865442-8604-4f5c-8099-72eba87d9b2b { ValidationException: The provided key element does not match the schema
不明显我的错误是什么? 有想法吗?