Skip to content

Can not get original ParseObject correctly in afterSave hook when update the ParseObject #957

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

Closed
3 tasks
wangmengyan95 opened this issue Mar 10, 2016 · 0 comments
Assignees
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@wangmengyan95
Copy link
Contributor

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

Run parse-server master branch locally

Steps to reproduce

Step 1. Set a afterSave hook for a ParseObject like

Parse.Cloud.afterSave('Test', function(req) {
  console.log(req.original._toFullJSON());
});

Step 2. Create a ParseObject by REST API

curl -X POST -H "X-Parse-Application-Id: myAppId"   -H "Content-Type: application/json"   -d '{"key":"value", "ACL": {"*": {"write": true}}}'   http://localhost:1337/parse/classes/LQACL

Step 3. Update the ParseObject by REST API

curl -X PUT -H "X-Parse-Application-Id: myAppId"   -H "Content-Type: application/json"   -d '{"key":"value1"}'   http://localhost:1337/parse/classes/LQACL/XXXX

Logs/Trace

The log of the cloud code is

{ objectId: 'iBVBtKnluf', __type: 'Object', className: 'LQACL' }

You can see we miss ACL and key fields.

The reason is in rest.js, we do a query to find the original value of the ParseObject before update, however, if the current req do not have permission to get access to the ParseObject, we can not find the original ParseObject.

@wangmengyan95 wangmengyan95 added the type:bug Impaired feature or lacking behavior that is likely assumed label Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants