gadelkareem / sails-dynamodb

Amazon DynamoDB adapter for Waterline / Sails.js
http://sailsjs.org
46 stars 22 forks source link

Lodash 4.0 issue #21

Open talvor opened 8 years ago

talvor commented 8 years ago

The lodash depencency in package.json does not specify a version. Lodash has just released 4.0 which now breaks the adapter. The following error is received.

[Error: Must have one or two primary key attributes.]
Unhandled rejection Error: Must have one or two primary key attributes.
    at Object.module.exports.adapter._createModel (C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\index.js:150:15)
    at C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\index.js:352:17
    at C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\node_modules\lodash\lodash.js:3925:15
    at baseForOwn (C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\node_modules\lodash\lodash.js:2521:24)
    at Function.forOwn (C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\node_modules\lodash\lodash.js:10734:24)
    at Object.module.exports.adapter.registerConnection (C:\Users\phall\Projects\leap-auth\node_modules\sails-dynamodb\index.js:351:9)
    at C:\Users\phall\Projects\leap-auth\node_modules\waterline\lib\waterline.js:203:29
    at C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:162:20
    at C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:230:13
    at _arrayEach (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:81:9)
    at _each (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:72:13)
    at Object.async.forEachOf.async.eachOf (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:229:9)
    at Object.async.forEach.async.each (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:206:22)
    at Array.async.auto.registerConnections (C:\Users\phall\Projects\leap-auth\node_modules\waterline\lib\waterline.js:176:13)

    at C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:590:38
    at _arrayEach (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:81:9)
    at Object.async.auto (C:\Users\phall\Projects\leap-auth\node_modules\waterline\node_modules\async\lib\async.js:552:9)
    at Waterline.initialize (C:\Users\phall\Projects\leap-auth\node_modules\waterline\lib\waterline.js:121:9)
    at C:\Users\phall\Projects\leap-auth\node_modules\waterline-models\index.js:52:19
    at tryCatcher (C:\Users\phall\Projects\leap-auth\node_modules\waterline-models\node_modules\bluebird\js\main\util.js:26:23)
    at Function.Promise.fromNode (C:\Users\phall\Projects\leap-auth\node_modules\waterline-models\node_modules\bluebird\js\main\promise.js:165:30)
    at C:\Users\phall\Projects\leap-auth\node_modules\waterline-models\index.js:51:22

I have resolved this by deleting the lodash folder from the node_modules\sails-dynamodb\node_modules folder so during runtime the top level lodash is used.

The package.json file needs to specify a dependency on lodash ^3.0.0.

devinivy commented 8 years ago

22 merged. Can't right now, but will try to get a release out soon.