{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2930","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2930/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2930/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2930/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/2930","id":185011153,"number":2930,"title":"request.user is \"undefined\" in the \"beforeSave\" function in the Cloud code","user":{"login":"grassland-curing-cfa","id":17244571,"avatar_url":"https://avatars.githubusercontent.com/u/17244571?v=3","gravatar_id":"","url":"https://api.github.com/users/grassland-curing-cfa","html_url":"https://github.com/grassland-curing-cfa","followers_url":"https://api.github.com/users/grassland-curing-cfa/followers","following_url":"https://api.github.com/users/grassland-curing-cfa/following{/other_user}","gists_url":"https://api.github.com/users/grassland-curing-cfa/gists{/gist_id}","starred_url":"https://api.github.com/users/grassland-curing-cfa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grassland-curing-cfa/subscriptions","organizations_url":"https://api.github.com/users/grassland-curing-cfa/orgs","repos_url":"https://api.github.com/users/grassland-curing-cfa/repos","events_url":"https://api.github.com/users/grassland-curing-cfa/events{/privacy}","received_events_url":"https://api.github.com/users/grassland-curing-cfa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-25T03:39:25Z","updated_at":"2016-10-25T13:45:34Z","closed_at":null,"body":"In my ParseServer migrated into the Heroko + mLab stack,\r\n\r\nI have a beforeSave function set for a custom \"OBSERVATION\" Class as below.\r\n\r\nParse.Cloud.beforeSave(\"OBSERVATION\", function(request, response) {\r\n    ... ...\r\n    var currUser = request.user;\r\n    console.log(request);\r\n    console.log(\"*** User objectId: \" + currUser.id + \"; \" + currUser.getSessionToken());\r\n    ... ...\r\n});\r\n\r\nI want to get the user name triggering the Save event. According to the Parse JavaScript SDK Reference, a \"BeforeSaveRequest\" takes a \"user\" as a member, which represents the User triggering the \"Save\" event.\r\n\r\nHowever, this is always \"undefined\" for me. Is there anything I missed or did wrong?\r\n\r\n\r\n### Steps to reproduce\r\n\r\nPlease include a detailed list of steps that reproduce the issue. Include curl commands when applicable.\r\n\r\n1. In the BeforeSave function, add \r\n    console.log(request);\r\n\r\n#### Expected Results\r\n\r\n { triggerName: 'beforeSave', \r\n   **user: {ParseObject {\r\n    sessionToken: 'xxxxxxxxxxxxxxx',\r\n    id: 'hDijlsmDP'\r\n    }},**\r\n   object:  \r\n    ParseObject { \r\n      _objCount: 1538, \r\n      className: 'OBSERVATION', \r\n      id: 'xUskfmanDY' }, \r\n   master: true, \r\n   log: FileLoggerAdapter {}, \r\n   original:  \r\n    ParseObject { \r\n      _objCount: 1541, \r\n      className: 'OBSERVATION', \r\n      id: 'xUskfmanDY' }\r\n } \r\n\r\n#### Actual Outcome\r\n { triggerName: 'beforeSave', \r\n   object:  \r\n    ParseObject { \r\n      _objCount: 1538, \r\n      className: 'OBSERVATION', \r\n      id: 'xUskfmanDY' }, \r\n   master: true, \r\n   log: FileLoggerAdapter {}, \r\n   original:  \r\n    ParseObject { \r\n      _objCount: 1541, \r\n      className: 'OBSERVATION', \r\n      id: 'xUskfmanDY' }\r\n } \r\n\r\n### Environment Setup\r\n\r\n- **Server**\r\n  - parse-server version (Be specific! Don't say 'latest'.) : 2.2.15\r\n  - Operating System:     Heroku Linux\r\n  - Hardware:             Heroku Dyno\r\n  - Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku\r\n\r\n- **Database**\r\n  - MongoDB version: 3.0\r\n  - Storage engine:  Unknown\r\n  - Hardware:       Unknown\r\n  - Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab\r\n\r\n### Logs/Trace\r\n\r\nYou can turn on additional logging by configuring VERBOSE=1 in your environment.\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/comments/256038803","html_url":"https://github.com/ParsePlatform/parse-server/issues/2930#issuecomment-256038803","issue_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2930","id":256038803,"user":{"login":"florianbepunkt","id":8314202,"avatar_url":"https://avatars.githubusercontent.com/u/8314202?v=3","gravatar_id":"","url":"https://api.github.com/users/florianbepunkt","html_url":"https://github.com/florianbepunkt","followers_url":"https://api.github.com/users/florianbepunkt/followers","following_url":"https://api.github.com/users/florianbepunkt/following{/other_user}","gists_url":"https://api.github.com/users/florianbepunkt/gists{/gist_id}","starred_url":"https://api.github.com/users/florianbepunkt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/florianbepunkt/subscriptions","organizations_url":"https://api.github.com/users/florianbepunkt/orgs","repos_url":"https://api.github.com/users/florianbepunkt/repos","events_url":"https://api.github.com/users/florianbepunkt/events{/privacy}","received_events_url":"https://api.github.com/users/florianbepunkt/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T13:45:34Z","updated_at":"2016-10-25T13:45:34Z","body":"I see the same behaviour in afterSave cloud functions. request.user is always undefined"}}
{"actor":{"display_login":"florianbepunkt"}}