dynamodb "GetItem operation: Requested resource not found" / "The provided key element does not match the schema"
dynamodb "GetItem operation: Requested resource not found" / "The provided key element does not match the schema"
我不知道怎么解释:
$aws dynamodb scan --table-name Todos-dev
...
{
"Items": [
{
"todoId": {
"S": "9e6e7f0f-97ee-4289-93b9-cb1bf46d5190"
},
"createdAt": {
"S": "2019-12-29T07:11:09.581Z"
},
"name": {
"S": "test4"
},
"userId": {
和
$ aws dynamodb get-item --table-name Todos.dev --key file://key.json
An error occurred (ResourceNotFoundException) when calling the GetItem operation: Requested resource not found
哪里
$ cat key.json
{"todoId": {"S": "9e6e7f0f-97ee-4289-93b9-cb1bf46d5190"}}
serverless.yml
TodosTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: todoId
AttributeType: S
- AttributeName: createdAt
AttributeType: S
- AttributeName: dueDate
AttributeType: S
KeySchema:
- AttributeName: todoId
KeyType: HASH
- AttributeName: createdAt
KeyType: RANGE
BillingMode: PAY_PER_REQUEST
TableName: ${self:provider.environment.TODOS_TABLE}
LocalSecondaryIndexes:
- IndexName: ${self:provider.environment.INDEX_NAME}
KeySchema:
- AttributeName: todoId
KeyType: HASH
- AttributeName: dueDate
KeyType: RANGE
Projection:
ProjectionType: ALL
我收到的消息 "The provided key element does not match the schema" 来自 docClient.delete,尝试了多种组合来指定密钥,但没有任何效果。
关键元素与架构不匹配
您的 table 有一个散列键和一个范围键。您的 key.json
文件只有散列键。使用 getItem
时,您必须提供完整(散列和范围)键。如果要为同一个散列键获取多个值,或者如果范围键值未知,则可以仅使用散列键,但必须使用 query
api 代替。
找不到资源
您在扫描调用中使用 Todos-dev
,但在 getItem 调用中使用 Todos.dev
。
我不知道怎么解释:
$aws dynamodb scan --table-name Todos-dev
...
{
"Items": [
{
"todoId": {
"S": "9e6e7f0f-97ee-4289-93b9-cb1bf46d5190"
},
"createdAt": {
"S": "2019-12-29T07:11:09.581Z"
},
"name": {
"S": "test4"
},
"userId": {
和
$ aws dynamodb get-item --table-name Todos.dev --key file://key.json
An error occurred (ResourceNotFoundException) when calling the GetItem operation: Requested resource not found
哪里
$ cat key.json
{"todoId": {"S": "9e6e7f0f-97ee-4289-93b9-cb1bf46d5190"}}
serverless.yml
TodosTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: todoId
AttributeType: S
- AttributeName: createdAt
AttributeType: S
- AttributeName: dueDate
AttributeType: S
KeySchema:
- AttributeName: todoId
KeyType: HASH
- AttributeName: createdAt
KeyType: RANGE
BillingMode: PAY_PER_REQUEST
TableName: ${self:provider.environment.TODOS_TABLE}
LocalSecondaryIndexes:
- IndexName: ${self:provider.environment.INDEX_NAME}
KeySchema:
- AttributeName: todoId
KeyType: HASH
- AttributeName: dueDate
KeyType: RANGE
Projection:
ProjectionType: ALL
我收到的消息 "The provided key element does not match the schema" 来自 docClient.delete,尝试了多种组合来指定密钥,但没有任何效果。
关键元素与架构不匹配
您的 table 有一个散列键和一个范围键。您的 key.json
文件只有散列键。使用 getItem
时,您必须提供完整(散列和范围)键。如果要为同一个散列键获取多个值,或者如果范围键值未知,则可以仅使用散列键,但必须使用 query
api 代替。
找不到资源
您在扫描调用中使用 Todos-dev
,但在 getItem 调用中使用 Todos.dev
。