前提・実現したいこと
Localで起動しているDynamoDBで、AWS-SDK を利用してテーブルを作成したい
発生している問題・エラーメッセージ
{ message: 'No Hash Key specified in schema. All Dynamo DB tables must have exactly one hash key', code: 'ValidationException', time: 2018-02-27T03:51:04.370Z, requestId: '08e3519a-28a6-442d-9669-a7386bc43479', statusCode: 400, retryable: false, retryDelay: 28.733315363793423 }
該当のソースコード
const AWS = require('aws-sdk') const dynamo = new AWS.DynamoDB({ region: "us-west-2", endpoint: "http://localhost:8000" }); const tableParams = { AttributeDefinitions: [ { AttributeName: "id", AttributeType: "S" }, { AttributeName: "github_id", AttributeType: "S" } ], KeySchema: [{ KeyType: "Hash", AttributeName: "id" }], ProvisionedThroughput: { ReadCapacityUnits: 1, WriteCapacityUnits: 1 }, TableName: "User" } dynamo.createTable(tableParams, (err, data) => { if (err) console.log(err, err.stack); else console.log(data); });
試したこと
入力するAttributesの順番を色々いじりましたが、やっぱりだめでした。
補足情報(FW/ツールのバージョンなど)
No Hash Key specified in schema. All Dynamo DB tables must have exactly one hash key
ということから、hash keyが無いと言われていることはわかりますが、KeySchemaで定義しているつもりでいます。KeySchemaの定義に関しても、sample codeと差異があるようには見えません。
dynamodb localのサンプルコードに、手を加えて実行しています。
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/28 00:02