Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.user is undefined after v2.1.4 #851

Closed
tanmays opened this issue Mar 5, 2016 · 6 comments
Closed

request.user is undefined after v2.1.4 #851

tanmays opened this issue Mar 5, 2016 · 6 comments

Comments

@tanmays
Copy link

tanmays commented Mar 5, 2016

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);
      }
  });

});
@tobernguyen
Copy link
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.

@tobernguyen
Copy link
Contributor

What login method do you use?

@tanmays
Copy link
Author

tanmays commented Mar 5, 2016

@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)

@tobernguyen
Copy link
Contributor

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

@tanmays
Copy link
Author

tanmays commented Mar 5, 2016

@tobernguyen thanks! Will check it out 👍

@gfosco
Copy link
Contributor

gfosco commented Mar 6, 2016

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants