实际上,我尝试使用Sailsjs作为DynamoDB数据库启动一个项目。
在互联网上搜索我找到了这个软件包 https://github.com/dohzoh/sails-dynamodb,我发现他们有完整的初始设置文档。
我将这个包安装到我的项目中,然后按如下方式设置项目:
配置/连接.js :
dynamoDb: {
adapter: "sails-dynamodb"
},
和配置/型号.js:
connection: 'dynamoDb'
我把我的亚马逊密钥放在node_modules/sails-dynamodb/credentials.json
我创建下一个模型:
module.exports = {
attributes: {
idFacebook : {
type : 'string',
unique: true
},
emailUser : {
type : 'string',
required : true
},
nameUser : {
type: 'string',
required : true
},
lastNameUser : {
type: 'string',
required : true
}
}
};
当我扬帆升起时,抛出下一个错误:
/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/request.js:32
throw err;
^
Error: define no longer accepts schema callback, migrate to new api
at Object.vogels.define (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/lib/index.js:126:11)
at Object.module.exports.adapter._getModel (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/index.js:169:23)
at Object.module.exports.adapter.define (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/index.js:289:33)
at /usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/adapter/ddl/index.js:60:15
at bound (/usr/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:957:21)
at applyInOriginalCtx (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:416:80)
at wrappedCallback (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:315:18)
at _normalizeCallback.callback.success (/usr/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
at _switch (/usr/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/factory.js:48:28)
at Response.<anonymous> (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/index.js:340:21)
at Request.<anonymous> (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/request.js:350:18)
at Request.callListeners (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/sequential_executor.js:100:18)
at Request.emit (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/request.js:604:14)
at Request.transition (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/request.js:21:12)
at AcceptorStateMachine.runTo (/home/uppersky01/proyectos/gameMouseCat/node_modules/sails-dynamodb/node_modules/vogels/node_modules/aws-sdk/lib/state_machine.js:14:12)
我正在寻找类似的错误,但是我还没有找到这个问题的答案。我希望有人能帮助我。
谢谢
我也遇到了同样的问题。您可以尝试降级当前版本的"vogels"模块。前段时间它对我有用,但我不得不稍后升级它,因为我必须使用较新版本的"aws-sdk"。
也许vogels@0.12.0有效。我不记得确切了,但您可以尝试更多版本。