Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error crashing node server when validation fails #63

Open
ghost opened this issue May 28, 2016 · 6 comments
Open

Error crashing node server when validation fails #63

ghost opened this issue May 28, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented May 28, 2016

This looks very familiar to #54, server crashes on every validation failure: short password, wrong email format, missing parameter etc.

debug:  Error (E_VALIDATION) :: 1 attribute is invalid
    at WLValidationError.WLError (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:25:15)
    at new WLValidationError (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:19:28)
    at _afterValidating (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:53:23)
    at allValidationsChecked (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:265:12)
    at /home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:52:16
    at Object.async.forEachOf.async.eachOf (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:236:30)
    at Object.async.forEach.async.each (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:209:22)
    at Validator.validate (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:144:9)
    at /home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:42:25
    at /home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:718:13
    at Immediate.iterate [as _onImmediate] (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:262:13)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
error: Sending 500 ("Server Error") response:
 Error (E_VALIDATION) :: 1 attribute is invalid
    at WLValidationError.WLError (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:25:15)
    at new WLValidationError (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:19:28)
    at _afterValidating (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:53:23)
    at allValidationsChecked (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:265:12)
    at /home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:52:16
    at Object.async.forEachOf.async.eachOf (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:236:30)
    at Object.async.forEach.async.each (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:209:22)
    at Validator.validate (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:144:9)
    at /home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:42:25
    at /home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:718:13
    at Immediate.iterate [as _onImmediate] (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:262:13)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Invalid attributes sent to Auth:
 • password
   • "minLength" validation rule failed for input: '123'
Specifically, it threw an error.  Details:
 undefined

debug: user register failure
_http_outgoing.js:344
    throw new Error('Can\'t set headers after they are sent.');
    ^

Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:344:11)
    at ServerResponse.res.setHeader (/home/user/.nvm/versions/node/v4.4.5/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:134:22)
    at ServerResponse.res.set.res.header (/home/user/project/node_modules/sails/node_modules/express/lib/response.js:595:10)
    at ServerResponse.res.send (/home/user/project/node_modules/sails/node_modules/express/lib/response.js:151:12)
    at ServerResponse.res.json (/home/user/project/node_modules/sails/node_modules/express/lib/response.js:237:15)
    at ServerResponse.jsonx (/home/user/project/node_modules/sails/lib/hooks/responses/index.js:222:21)
    at Object.forbidden (/home/user/project/api/responses/forbidden.js:41:16)
    at ServerResponse.wrapper [as forbidden] (/home/user/project/node_modules/sails/node_modules/lodash/index.js:3095:19)
    at Object.registerFailure (/home/user/project/node_modules/waterlock/lib/cycle.js:121:13)
    at /home/user/project/node_modules/waterlock-local-auth/lib/controllers/actions/register.js:33:25
    at /home/user/project/node_modules/waterlock/lib/engine.js:90:18
    at wrapper (/home/user/project/node_modules/sails/node_modules/lodash/index.js:3592:19)
    at applyInOriginalCtx (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:421:80)
    at wrappedCallback (/home/user/project/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:335:16)
    at callback.error (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/normalize.js:42:31)
    at _switch (/home/user/project/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/factory.js:56:28)

@ghost
Copy link
Author

ghost commented May 28, 2016

#50 seems to fix the issue, I believe the npm package needs an update

@cyri113
Copy link

cyri113 commented May 29, 2016

@dimka2 - you are right, the scope.js file is outdated on npm.

@cyri113
Copy link

cyri113 commented May 29, 2016

@DavidRivera could you update the npm module? Thanks!

@mazemax
Copy link

mazemax commented Aug 16, 2016

Also #52 is required to make registration work correctly.

@dimitrovs
Copy link

Please update npm. Thanks.

@lord-otori
Copy link

For future reference
"waterlock-local-auth": "waterlock/waterlock-local-auth#cd935c1"
in my dependencies section of package.json to get this change.
Having this change in the latest version available through NPM would be great although I'm not sure what that entails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants