-
Notifications
You must be signed in to change notification settings - Fork 30
Validation error "must be an object" #56
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
Comments
did you got any success on this, I'm still struggling with this. Any help will be greatly appreciated. Thnx in advance. |
I am also getting the same error:
The error is caused when I attempt to call a method without an object // example
new ValidatedMethod({
name: 'methodName',
validate: new SimpleSchema({ text: { type: String }}).validator(),
run: function(data) {}
}); Meteor.call('methodName'); // causes Error: The first argument of validate() or validateOne() must be an object
Meteor.call('methodName', {}); // validation error (appropriate behavior) Edit: I thought this was causing my server to restart, but it was a different issue. This behavior is appropriate, and what is causing it was a call to a method that expects an object. Anyone else seeing this error should check to make sure they are sending the right arguments to a method call. |
I would like to be able to call a ValidatedMethod without an object argument when my method definition takes no arguments. I do understand that I could simply define these kinds of methods with the regular |
I'm guessing this is as designed. I had the same issue but the discussion above gave me the extra "a-ha" that I needed. You need to make sure that you pass an object when you're calling you're meteor method, because So:
|
this spoked me for a bit so i thought i'd share this. Meteor.call('AwesomeMethod, {key: value}, callback ) |
This is the error I find in terminal of my code. I cant resolve this exception. "Exception while invoking method 'myway.enterName' Error: The first argument of validate() or validateOne() must be an object". In console "Error invoking Method 'myway.enterName': Internal server error [500]" this error is shown.
The text was updated successfully, but these errors were encountered: