I'm calling a Cloud Code function from a JavaScript application with a logged-in user, like this:
if (Parse.User.current()) { // just to assert there is a logged-in user
Parse.Cloud.run('foo').then(...);
}
In the Cloud Code function I want to access the current user (i.e. the user from whose context the function is called):
Parse.Cloud.define('foo', (req, res) => {
var user = req.user;
//...
}
Unfortunately, user
is undefined. Is this code supposed to work, or is there an obvious mistake?
P.S.: Using parse-server 2.2.7 (based on parse-server-example) and parse-SDK-JS 1.8.3.