Parse Cloud Code retrieving a user with objectId
I am trying to get the user object from objectId. I know the objectId is valid. But I can get this simple query to work. What is wrong with it? user is still undefined after the query. var getUserObject = function(userId){ Parse.Cloud.useMasterKey(); var user; var userQuery = new Parse.Query(Parse.User); userQuery.equalTo("objectId", userId); userQuery.first({ success: function(userRetrieved){ console.log('UserRetrieved is :' + userRetrieved.get("firstName")); user = userRetrieved; } }); console.log('\nUser is: '+ user+'\n'); return user; }; Quick cloud code example using promises. I've got