Dynamodb 响应代码 400 的确切原因
Dynamodb exact reason for response code 400
有什么方法可以找出 DynamoDB 响应代码 400 的确切原因吗?在试验 DynamoDB 时遇到问题。我的主键是主题,PostedTimeStamp 是排序键,我在类别上创建了一个 LSI。以下是创建 table 的命令。
aws dynamodb create-table --debug --table-name Topics --attribute-definitions AttributeName=Topic,AttributeType=S AttributeName=PostedTimeStamp,AttributeType=S AttributeName=Category,AttributeType=S AttributeName=SubCategory,AttributeType=S --key-schema AttributeName=Topic,KeyType=HASH AttributeName=PostedTimeStamp,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --local-secondary-indexes IndexName=TopicCategory,KeySchema=["{AttributeName=Topic, KeyType=HASH}","{AttributeName=Category, KeyType=RANGE}"],Projection="{ProjectionType=KEYS_ONLY}" IndexName=TopicSubCategory,KeySchema=["{AttributeName=Topic,KeyType=HASH }","{AttributeName=SubCategory,KeyType=RANGE}"],Projection="{ProjectionType=KEYS_ONLY"}
以下是我正在尝试的查询 运行。
{
"TableName": "Topics",
"IndexName": "TopicCategory",
"ConsistentRead": false,
"KeyConditionExpression": "Topic = :v1 and Category = :v2",
"ExpressionAttributeValues": {
":v1": {
"S": "DyanmoDB"
}
":v2": {
"S": "LSI"
}
}
}
收到以下响应...这对于许多错误来说很常见...例如 InvalidAction、InvalidParameterCombination、InvalidQueryParameter 等。
"Received response. Status: 400, Integration latency: 6 ms
用逗号分隔 ExpressionAttributeValues
将解决您的问题。
{
"TableName": "Topics",
"IndexName": "TopicCategory",
"ConsistentRead": false,
"KeyConditionExpression": "Topic = :v1 and Category = :v2",
"ExpressionAttributeValues": {
":v1": {
"S": "DyanmoDB"
}
,
":v2": {
"S": "LSI"
}
}
}
我建议你,首先在本地 dynamodb 中测试你的 Mapping Templates
代码,它会给你更多的错误解释。
有什么方法可以找出 DynamoDB 响应代码 400 的确切原因吗?在试验 DynamoDB 时遇到问题。我的主键是主题,PostedTimeStamp 是排序键,我在类别上创建了一个 LSI。以下是创建 table 的命令。
aws dynamodb create-table --debug --table-name Topics --attribute-definitions AttributeName=Topic,AttributeType=S AttributeName=PostedTimeStamp,AttributeType=S AttributeName=Category,AttributeType=S AttributeName=SubCategory,AttributeType=S --key-schema AttributeName=Topic,KeyType=HASH AttributeName=PostedTimeStamp,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --local-secondary-indexes IndexName=TopicCategory,KeySchema=["{AttributeName=Topic, KeyType=HASH}","{AttributeName=Category, KeyType=RANGE}"],Projection="{ProjectionType=KEYS_ONLY}" IndexName=TopicSubCategory,KeySchema=["{AttributeName=Topic,KeyType=HASH }","{AttributeName=SubCategory,KeyType=RANGE}"],Projection="{ProjectionType=KEYS_ONLY"}
以下是我正在尝试的查询 运行。
{
"TableName": "Topics",
"IndexName": "TopicCategory",
"ConsistentRead": false,
"KeyConditionExpression": "Topic = :v1 and Category = :v2",
"ExpressionAttributeValues": {
":v1": {
"S": "DyanmoDB"
}
":v2": {
"S": "LSI"
}
}
}
收到以下响应...这对于许多错误来说很常见...例如 InvalidAction、InvalidParameterCombination、InvalidQueryParameter 等。
"Received response. Status: 400, Integration latency: 6 ms
用逗号分隔 ExpressionAttributeValues
将解决您的问题。
{
"TableName": "Topics",
"IndexName": "TopicCategory",
"ConsistentRead": false,
"KeyConditionExpression": "Topic = :v1 and Category = :v2",
"ExpressionAttributeValues": {
":v1": {
"S": "DyanmoDB"
}
,
":v2": {
"S": "LSI"
}
}
}
我建议你,首先在本地 dynamodb 中测试你的 Mapping Templates
代码,它会给你更多的错误解释。