I’m using validated-method to created an insert method but it crash to run meteor
export const hasAtLeastOnePenpal = new ValidatedMethod({
name: 'hasAtLeastOnePenpal',
validate: new SimpleSchema({
id: { type: String }
}).validator(),
run(id) {
return true
}
});
error message
I20170113-10:12:35.409(1)? info: =====> Meteor App restarted Fri Jan 13 2017 10:12:35 GMT+0100 (CET) <=====
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.`
Have you done:
meteor add mdg:validated-method aldeed:simple-schema
?
yes done and the same problem
Can we see the full, unedited log?
How to read the unedited log
it is not my code
I20170113-10:12:35.409(1)? info: =====> Meteor App restarted Fri Jan 13 2017 10:12:35 GMT+0100 (CET) <=====
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.`
Did you only get those three lines?
yes i got only those lines
I can’t get an error with the code you showed.
What happens if you comment out your validated method (is the error somewhere else)?
it works the problem is when i put a validate method if remove it works
TypeError: ValidatedMethod is not a function
You propably need to import it.
@henribeck : importing is not strictly necessary at the moment, although it’s probably good practice .
@neutron92 : I cannot get your validated method to fail (incidentally, I’ve tested with and without importing). Can you put a repo together so I can clone and test your implementation?
Importing is not necessary when the file isn’t inside the imports folder
though we don’t know where the file is located so i guessed its a import
error.
1 Like
Good point for hasAtLeastOnePenpal()
: @neutron92 : did you import it where you’re using it?
I dont think it has to do with the importing of the method as the error says that ValidatedMethod is not defined.