Skip to content

request.user is "undefined" in the "beforeSave" function in the Cloud code #2929

Closed
@grassland-curing-cfa

Description

@grassland-curing-cfa

In my ParseServer migrated into the Heroko + mLab stack,

I have a beforeSave function set for a custom "OBSERVATION" Class as below.

Parse.Cloud.beforeSave("OBSERVATION", function(request, response) {
    ... ...
    var currUser = request.user;
    console.log(request);
    console.log("*** User objectId: " + currUser.id + "; " + currUser.getSessionToken());
    ... ...
});

I want to get the user name triggering the Save event. According to the Parse JavaScript SDK Reference, a "BeforeSaveRequest" takes a <Parse.User> as a member, which represents the User triggering the "Save" event.

However, this is always "undefined" for me. Is there anything I missed or did wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions