有人可以分享有关如何让vogels工作dynalite的信息吗?
这是我在计算机上本地实例化数据库服务器的方法:
import dynalite from 'dynalite';
import packageJSON from '../package.json'
// Returns a standard Node.js HTTP server
const dynaliteServer = dynalite({ path: '../mydb', createTableMs: 50 })
dynaliteServer.listen(packageJSON.config.endpointPort, function (err) {
if (err) throw err
console.log('Dynalite started on port ' + packageJSON.config.endpointPort);
});
这是我尝试初始化 vogels 的内容:
import packageJSON from '../package.json';
import AWS from 'aws-sdk';
import vogels from 'vogels';
export default function initContext() {
const AWSConfig = {
accessKeyId: packageJSON.config.KEY,
secretAccessKey: packageJSON.config.SECRET,
region: packageJSON.config.region,
endpoint: packageJSON.config.endpoint
};
//config AWD
AWS.config.update(AWSConfig);
//create dynamodb instance
const dynamodb = new AWS.DynamoDB(AWSConfig);
//config vogels AWS
vogels.AWS.config.update(AWSConfig);
vogels.dynamoDriver(dynamodb);
return {
dynamodb,
vogels
};
}
我已经定义了一个模型并尝试在一个名为的文件中创建它initDB.js
:
initContext();
myVogelsModel.create({
name: 'foo',
email: 'foo@example.com',
}, function (err, model) {
console.log(err);
});
但它只给我返回了错误:
{ [ResourceNotFoundException: Requested resource not found]
message: 'Requested resource not found',
code: 'ResourceNotFoundException',
time: Thu Feb 09 2017 22:53:46 GMT+0100 (Paris, Madrid),
requestId: 'CATZQFWSMVJKOLP0YTIMU9IEVSLJBVAB7NJB8L3EIHXCDXLT30AQ',
statusCode: 400,
retryable: false,
retryDelay: 0 }
C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\request.js:31
throw err;
^
TypeError: Cannot read property 'get' of undefined
at C:/Users/damien/Documents/workspace/myProject/src/initDB.js:23:34
at C:\Users\damien\Documents\workspace\myProject\node_modules\vogels\lib\table.js:193:16
at Response.<anonymous> (C:\Users\damien\Documents\workspace\myProject\node_modules\vogels\lib\table.js:69:14)
at Request.<anonymous> (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\request.js:355:18)
at Request.callListeners (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
at Request.emit (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
at Request.emit (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\request.js:668:14)
at Request.transition (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Users\damien\Documents\workspace\myProject\node_modules\aws-sdk\lib\state_machine.js:26:10
任何提示将不胜感激:)