-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Undocumented behavior change for request.user
in cloud code
#4636
Comments
As I recall, on parse.com request.user was fetched with any authenticated request, then when parse-server was launched this was accidentally omitted but later fixed. |
@JacobJT I'm currently using 2.6.3 and when I make a REST api call to launch a cloud function, the resquest.user is undefined even if a valid session token is provided in the request. |
@dangtz can you provide the logs when running with VERBOSE=1 and req.user isn’t set? |
Sorry, it seems that this is due to the use of the master-key, after removed it, request.user is well defined : |
So everything is according to spec. Glad to hear! |
Issue Description
Undocumented behavior change for request.user in cloud code - used to be a User shell, seems to be a populated object now
Steps to reproduce
req.user
that should be set and isn't part of the shell objectExpected Results
Actual Outcome
Environment Setup
Logs/Trace
When calling
console.log("user.get('firstName' == " + user.get('firstName'));
user.get('firstName') == Jake
Expected this to print
user.get('firstName') == (undefined)
.I know in the past I had to fetch the user before being able to access its data. I couldn't find any PR's or release notes relating to this, and the issues I found seemed to revolve around request.user being undefined entirely. I came across this update on accident, and am trying to figure out if it is safe to assume that
request.user
will be populated if a valid session token is when I call cloud functions. As I'm performing some unnecessary fetches if I no longer need them, I'd love to clean up some of my code, but can't find hard info on this change.The text was updated successfully, but these errors were encountered: