Skip to content

Undocumented behavior change for request.user in cloud code #4636

Closed
@JacobJT

Description

@JacobJT

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

  • Call a cloud code function
  • in the cloud code function print out any field from req.user that should be set and isn't part of the shell object

Expected Results

  • The field will be undefined

Actual Outcome

  • The field's data exists

Environment Setup

  • Server
    • parse-server version (Be specific! Don't say 'latest'.) : 2.7.4
    • Operating System: OSX 10.12.6
    • Hardware: MacBook Pro 2015
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS / Local

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.

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