gadelkareem / sails-dynamodb

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

adapter error on Model.create #30

Open 172478394 opened 8 years ago

172478394 commented 8 years ago

I get this error when i call Model.create() after setting schema to false:

/node_modules/waterline/lib/waterline/error/WLError.js:29 this.rawStack = (this.e.stack.replace(/^Error(\r|\n)(\r|\n)_/, ''));

TypeError: Cannot read property 'replace' of undefined at new WLError (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:29:33) at duckType (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/index.js:66:10) at errorify (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/index.js:39:10) at wrappedCallback (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:329:15) at callback.error (/usr/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/normalize.js:42:31) at _switch (/usr/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/factory.js:56:28) at /home/leoyu/dynamoProject/node_modules/sails-dynamodb/index.js:850:11 at /home/leoyu/dynamoProject/node_modules/vogels/lib/table.js:119:14 at start (/home/leoyu/dynamoProject/node_modules/vogels/lib/table.js:108:12) at fn (/home/leoyu/dynamoProject/node_modules/vogels/node_modules/async/lib/async.js:626:34) at Immediate._onImmediate (/home/leoyu/dynamoProject/node_modules/vogels/node_modules/async/lib/async.js:542:34) at tryOnImmediate (timers.js:543:15) at processImmediate as _immediateCallback

devinivy commented 8 years ago

That looks like an error that occurred within waterline– hard to tell if it has to do with this adapter or not. Can you get a hold of that error waterline was trying to display (but failed to display, since its stack was undefined)?

devinivy commented 8 years ago

It may involve some logging here: https://github.com/gadelkareem/sails-dynamodb/blob/fa295c1d383b2dc020de3438ab60af63e32970c1/index.js#L850

traverseDLP commented 8 years ago

The error occurs because the waterline adapter is trying to be clever when formatting the raw stack to be logged, and using a property that doesn't exist. If you're looking to get closer to the root problem, just edit

{application root}/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js

Replace lines 28 and 29 with this:

// Doctor up a modified version of the stack trace called rawStack: this.rawStack = this._e.stack;//(this.e.stack.replace(/^Error(\r|\n)(\r|\n)_/, ''));

Someone could actually fix it in the repo, too...

Sam Brown Lead Developer & VP of Technology 207.475.7779 <207-475-7779> | sam@traversedlp.com @traversedlp http://twitter.com/traversedlp | www.traversedlp.com

On Mon, Aug 29, 2016 at 8:27 AM, devin ivy notifications@github.com wrote:

It may involve some logging here: https://github.com/ gadelkareem/sails-dynamodb/blob/fa295c1d383b2dc020de3438ab60af 63e32970c1/index.js#L850

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gadelkareem/sails-dynamodb/issues/30#issuecomment-243109844, or mute the thread https://github.com/notifications/unsubscribe-auth/AOU3KpCtLJc8j5SGKISGuaQ0P77E9Hcnks5qktA7gaJpZM4JvSri .

172478394 commented 8 years ago

I want to store some key-value, but they are not in the schema, how should I do