0

I'm trying to update a the user "photoPath" field after uploading a file using meteor-uploads. I'm getting this error :

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.

server/init.js

validateFile: function(file, req) {
    Meteor.users.update( { _id: Meteor.userId() }, {$set: {"profile.photoPath": req.path}});

    return null; 
}
Miguel Morujão
  • 1,071
  • 1
  • 12
  • 37
  • 1
    Possible duplicate of ["Meteor code must always run within a Fiber" when calling Collection.insert on server](http://stackoverflow.com/questions/10192938/meteor-code-must-always-run-within-a-fiber-when-calling-collection-insert-on-s) – vijayst Jul 13 '16 at 13:29

1 Answers1

2

you should use
this.userId to access user from server side

khem poudel
  • 577
  • 6
  • 13