tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

Trying to use the backend of this and getting validation error #97

Closed cwoloszynski closed 9 years ago

cwoloszynski commented 9 years ago

I have cloned the backend repository and then did a sails lift. I get an error:

beforeValidate: {"username":"admin","email":"admin@some.domain","firstName":"Arnold","lastName":"Administrator","admin":true,"createdUser":1,"updatedUser":1} beforeValidate: {"username":"demo","email":"demo@some.domain","firstName":"John","lastName":"Doe","admin":false,"createdUser":1,"updatedUser":1} error: A hook (load-db) failed to load! error: Error (E_VALIDATION) :: 1 attribute is invalid at WLValidationError.WLError (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:26:15) at new WLValidationError (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:20:28) at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:46:43 at allValidationsChecked (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:210:5) at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16 at done (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:239:19) at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16 at validate (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:152:76) at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:162:20 at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:230:13 at _arrayEach (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:81:9) at _each (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:72:13) at Object.async.forEachOf.async.eachOf (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:229:9) at Object.async.forEach.async.each (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:206:22) at Validator.validate (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:207:9) at async.series.runner (/home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:42:25) at /home/ec2-user/hhmedia-backend/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:699:13

But no actual report on the validation field that caused the error. Very weird. I am using the test/fixture data in the project.

Any suggestions on how to track down this bug?

cwoloszynski commented 9 years ago

Nevermind. I discovered that I had another model file (in a sub-directory that I thought would be ignored but it was not) with the same name (User.js). Changing this to have a new name (User1.js) solved this issue.