无服务器:dynamodb删除条件
我正在尝试删除带有条件的logging,并且失败。 我不断收到此错误: The provided key element does not match the schema
。
这是我在yml中的定义:
resources: Resources: vuelosTable: Type: 'AWS::DynamoDB::Table' DeletionPolicy: Delete Properties: AttributeDefinitions: - AttributeName: id AttributeType: S - AttributeName: vuelta AttributeType: S KeySchema: - AttributeName: id KeyType: HASH - AttributeName: vuelta KeyType: RANGE ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1 TableName: ${self:provider.environment.DYNAMODB_TABLE}
这些是试图删除时的参数:
params = { RequestItems: { [process.env.DYNAMODB_TABLE]: [{ DeleteRequest: { Key: { "vuelta": "2017-09-09" } } }] } };
我知道这是我没有得到的东西,但我不知道是什么。 有任何想法吗?
您的表格键是id
和vuelta
但您只是在删除请求中提供vuelta
。 修改您的删除请求中的密钥,使其包含id
和vuelta
。
另外,根据您的客户端库可能需要指定
Key: { id: { S: "some value" }, vuelta: { S: "some value" } }