【发布时间】:2015-08-04 22:03:42
【问题描述】:
我正在使用 dynamoDB-local 和 nodejs 代码。
我有以下代码:
var aws = require("aws-sdk")
aws.config.update({"accessKeyId": "aaa",
"secretAccessKey": "bbb",
"region": "us-east-1"})
var awsdb = new aws.DynamoDB({ endpoint: new aws.Endpoint("http://localhost:8000") });
awsdb.createTable({
TableName: 'myTbl',
AttributeDefinitions: [
{ AttributeName: 'aaa', AttributeType: 'S' },
],
KeySchema:[
{ AttributeName: 'aaa', KeyType: 'HASH' }
]
}, function() {
awsdb.listTables(function(err, data) {
console.log(data)
});
});
但它没有创建表。我在日志中收到{ TableNames: [] }。
err 为空。
【问题讨论】:
-
createTable将返回{ TableNames: [] }如果您的代码中已设置:::Aws.config[:stub_responses] = true(这是 Ruby,但您明白了)
标签: node.js amazon-web-services amazon-dynamodb