-
Notifications
You must be signed in to change notification settings - Fork 120
TypeError: Cannot read property 'service' of undefined (continued) #108
Comments
The Gist looks right so far but how are you using the exported app? The error most likely happens it app.setup is not called. It gets called automatically when you use app.listen but if you e.g. use it with a virtual host or HTTP server you need to call |
@daffl Here's the server file: https://gist.github.com/thosakwe/280e808bcc2175b273f1#file-server-js I changed it now to use |
How doe the request and |
Validator is feathers-validator. Long story short, it checks the hook's data for input errors. function create() {
return (hook) => {
let errors = new Validator(hook.data, {
username: "required|min:5|max:255",
password: "required|min:6",
email: "required|min:5|max:255"
}).errors();
if (errors.length) throw new Error(errors[0]);
}
} |
@thosakwe double check that your password field is there. That's a typical cause for that brypt error. I'm in the process of adding better error messaging for that. As an aside in your hook you might want to You also might want to check out @kulakowka's https://github.com/kulakowka/feathers-validate-hook. Maybe you guys can collaborate 😄 |
@ekryski Cool, I might contact him sooner or later. Anyways, that just leaves me with one more question. I hooked Since the create method is already hooked to deny requests if the password isn't there, I'm wondering if the bcrypt error is because I didn't check for a password on update or patch. Should I just remove hashPassword from update and patch? That might be the problem. |
@thosakwe oh ya that's probably the issue. |
I was doing all the above steps, and was getting nowhere. I looked over my setup again, and I realized that I overlooked the order of the hooks on my update and patch methods. I had verifyToken() after populateUser(). Thanks again for the help. |
@thosakwe glad you got it sorted. I have better error messages that will help hopefully make this more clear. |
Having a similar problem to #56.
Here's my app setup right now: Gist
I'm wondering what I messed up with.
Thanks in advance for your help, I appreciate that the Feathers team is responsive. It encourages me to keep using this framework.
The text was updated successfully, but these errors were encountered: