J'essaye d'obtenir un seul article de DynamoDB AWS et n'arrive pas à comprendre comment le spécifier avec le hachage et la clé de gamme. Voici est le describeTable et la sortie de balayage:Pourquoi getItem() renvoie-t-il un "type de valeur d'attribut invalide"?
// describeTable output:
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "timepost",
"AttributeType": "N"
},
{
"AttributeName": "addr",
"AttributeType": "S"
}
],
"TableName": "Scratch",
"KeySchema": [
{
"AttributeName": "timepost",
"KeyType": "HASH"
},
{
"AttributeName": "addr",
"KeyType": "RANGE"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2017-08-24T07:08:19.650Z",
"ProvisionedThroughput": {
"LastIncreaseDateTime": "1970-01-01T00:00:00.000Z",
"LastDecreaseDateTime": "1970-01-01T00:00:00.000Z",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"TableSizeBytes": 32,
"ItemCount": 1,
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Scratch"
}
}
// scan output:
{
"Items": [
{
"addr": "1.1.1.1:443",
"ms": 67,
"timepost": 12321340
}
],
"Count": 1,
"ScannedCount": 1
}
Voici mon getItem() le code et la sortie d'erreur:
docClient.get({
TableName: "Scratch",
Key: {
timepost: {N: '12321340'},
addr: {S: '1.1.1.1:443'}
}}, opComplete);
err: {
"message": "Invalid attribute value type",
"code": "ValidationException",
"time": "2017-08-26T15:56:59.938Z",
"requestId": "f9d94f20-f22d-4141-be06-2eaba1eee5a1",
"statusCode": 400,
"retryable": false,
"retryDelay": 26.507308215655236
}
Qu'est-ce que je fais mal?
Celui-ci me donne la même erreur, "Type de valeur d'attribut invalide". – noctonura