Chris Livett Chris Livett - 2 years ago 277
Javascript Question

Meteor validated method not found

I'm migrating my Meteor application from Meteor 1.2 to Meteor 1.3 and following the guide on to create a validated method.

When I call the method, I believe client-side simulation is happening, as I can log out to console, but this is always followed by the error

Method '...' not found


import {Meteor} from 'meteor/meteor';
import {Template} from 'meteor/templating';
import {FlowRouter} from 'meteor/kadira:flow-router';

// Methods
import {createAccount} from '/imports/api/accounts/methods.js';

import './register.html';{
'submit form': function(event) {

var user = {
email: $('#email').val(),
password: $('#password').val(),
profile: {
firstName: $('#firstName').val(),
lastName: $('#lastName').val()
};, function(err) {
if (err) {
} else {
console.log('User successfully registered');


import {Meteor} from 'meteor/meteor';
import {ValidatedMethod} from 'meteor/mdg:validated-method';
import {SimpleSchema} from 'meteor/aldeed:simple-schema';
import {Accounts} from 'meteor/accounts-base';

export const createAccount = new ValidatedMethod({
name: 'createAccount',
validate: new SimpleSchema({
email: { type: String },
password: { type: String },
profile: { type: Object },
"profile.firstName": { type: String },
"profile.lastName": { type: String }
run(user) {

Client console

Object {email: "", password: "testPassw0rd", profile: Object} methods.js:18
errorClass {error: 404, reason: "Method 'createAccount' not found", details: undefined, message: "Method 'createAccount' not found [404]", errorType: "Meteor.Error"} register.js:28

Answer Source

I believe the reason this wasn't working was because I was not initialising the javascript on the server at startup.

Adding the following fixed the issue:


import './register-api.js';


import '/imports/api/accounts/methods.js';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download