Skip to content

request.user is undefined after v2.1.4 #851

Closed

Description

@tanmays

Hello,

Ever since upgrading to 2.1.4, request.user is undefined in Cloud Code functions even after passing a valid session token. Prior to this release everything used to work well.

Here's an example:

Console log:

POST /parse/functions/GetBookmarks { host: '6115ba6a.ngrok.io',
  'content-type': 'application/json',
  'content-length': '0',
  'x-parse-session-token': 'r:<session-token-removed>',
  accept: '*/*',
  'user-agent': 'Pinglar/0.2 (iPhone; iOS 9.0.1; Scale/2.00)',
  'x-parse-application-id': 'xxx',
  'accept-language': 'en;q=1',
  'accept-encoding': 'gzip, deflate',
  'x-forwarded-proto': 'https',
  'x-forwarded-for': 'xxx.88.191.58' } {}
User is: undefined

Cloud Code:

Parse.Cloud.define("GetBookmarks", function(request, response) {

  var LinksSaved = Parse.Object.extend("LinksSaved");

  console.log("User is: " + JSON.stringify(request.user));

  var query = new Parse.Query(LinksSaved);
  query.equalTo("user", request.user);
  query.include("user");

  query.find({
      success: function(bookmarks) {
        response.success(bookmarks);
      },
      error: function(error) { // query error
        console.log("Unable to fetch bookmarks: "+ JSON.stringify(error));
        response.error(error);
      }
  });

});

Activity

  1. tobernguyen commented on Mar 5, 2016

    @tobernguyen
    Contributor

    @tanmays you may want to have a look on my issue reported here #852 . I think it is related to your problem because I also experienced it too.

    Please have a look and try to produce my issue to see if it is the reason of this your issue. Thanks.

  2. tobernguyen commented on Mar 5, 2016

    @tobernguyen
    Contributor

    What login method do you use?

  3. tanmays commented on Mar 5, 2016

    @tanmays
    Author

    @tobernguyen You're right. I tested it a bit more and can confirm the issue you are facing. It only happens when using social login. (Twitter in my case)

  4. tobernguyen commented on Mar 5, 2016

    @tobernguyen
    Contributor

    I just created a pull request to resolve that issue. Have a look here: #857

  5. tanmays commented on Mar 5, 2016

    @tanmays
    Author

    @tobernguyen thanks! Will check it out 👍

  6. gfosco commented on Mar 6, 2016

    @gfosco
    Contributor

    Fixed by 857 and will be in the next release. Sorry for the inconvenience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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