In my relatively simple code below, if I make the call in the client the client console immediately outputs ‘callback executing’. However, I never see the error or result which should also be logged in the client’s callback. My other Meteor.call functions all work as expected. I can’t pinpoint what I am doing wrong here, any ideas?
Client
Meteor.call('saveProject', LocalProject.findOne(currentEditingProjectID), function(error, result) {
console.log('callback executing');
if(error)console.log(error);
if (result) {
//do stuff...
console.log(result)
}
})
Server
'saveProject': function(data) {
if (!this.userId) {
throw new Meteor.Error(403, 'You must be logged in to save projects');
}
//validate data
//update modified time
data.meta.modified = new Date();
//perform save
return allProjects.update(data._id, data, function(error, result) {
if (error) {
console.log(error)
throw new Meteor.Error(500, 'Save failed');
}
if (result) {
console.log(result)
}
});
}