-
-
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
ParseObject still has deleteOperation in field after saveCallback, when using beforeSave in Cloud #1840
Comments
Which SDK are you using? This sounds like it might be an SDK issue. Either way, could you turn on verbose logging for your server with |
We are running the latest versions of the Android and iOS SDKs, with the same result for both. This is a test made with an Android Device, only returning success from before- and aftersave of an object.The test is simple. First "check in" a child-object and set values to it. Later when "Checking out" the child-object you remove some values from it. CloudParse.Cloud.beforeSave(‘myObjectName’, function(req, resp) { console.log("BF SAVE KID REQ " +JSON.stringify(req.object)); }); Parse.Cloud.afterSave('myObjectName', function(req, resp) { console.log("AF SAVE KID REQ" +JSON.stringify(req.object)); }); CHECK INBF SAVE KID REQ{"ACL":{ROLES},"DATE-value":{"__type":"Date","iso":"content"},"String-value":"content","bool":true,"String-value":"content","bool-value":true,"department":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"},{"__type":"Pointer","className":"_User","objectId":"content"}],"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content","String-value":"content","String-value":"content","pointer":{"__type":"Pointer","className":"dep_con","objectId":"content"},"String-value":"content","kidSick":false,"createdAt":"content","updatedAt":"content","String-value":"content","bool-value":true,”bool-value":true,"bool-value":true,"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"pickupInfo":"content”,"String-value":"content","pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content"} AF SAVE KID REQ{"ACL":{ROLES},"DATE-value":{"__type":"Date","iso":"content"},"String-value":"content","bool":true,"String-value":"content","bool-value":true,"department":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"},{"__type":"Pointer","className":"_User","objectId":"content"}],"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content","String-value":"content","String-value":"content","pointer":{"__type":"Pointer","className":"dep_con","objectId":"content"},"String-value":"content","kidSick":false,"createdAt":"content","updatedAt":"content","String-value":"content","bool-value":true,”bool-value":true,"bool-value":true,"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"pickupInfo":"content”,"String-value":"content","pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content"} RESPONSE CHECK IN KID (Client-side, no error):{"String-value":"content","String-value":"content","bool-value":"true","String-value":"content”,"String-value":"content","String-value":"content","bool-value":"true","ACL":"com.parse.ParseACL@428708b8","String-value":"content","pointer":{“_User”},"pointer":{"_User"},"bool-value":"false","lastName":"content","DATE-value":"content","bool-value":"true","bool-value":"true","bool-value":"true","pointer":{"_User"},"String-value":"content","pointer-array":"[com.parse.ParseUser@42660658, com.parse.ParseUser@42b734c0]","String-value":"content","String-value":"content","pointer":{"_User"},"String-value":"content","String-value":"content"} ResultThis is all fine setting the right values... CHECK OUTBF SAVE KID REQ{"ACL":{"ROLES”},"DATE-value":{"__type":"Date","iso":"content"},"String-value":"content","bool-value":true,"String-value":"content","bool-value":false,"String-value":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"},{"__type":"Pointer","className":"_User","objectId":"content"}],"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content","String-value":"content","String-value":"content",”pointer”:{"__type":"Pointer","className":"content","objectId":"content"},"String-value":"content","createdAt":"content","updatedAt":"content","String-value":"content","bool-value":true,"bool-value":true,"bool-value":true,"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":{"__op":"Delete"},"String-value":{"__op":"Delete"},"pointer":{"__op":"Delete"},"String-value":{"__op":"Delete"},”String-value":"content"} AF SAVE KID REQ (Still has DeleteOperation){"ACL":{"ROLES”},"DATE-value":{"__type":"Date","iso":"content"},"String-value":"content","bool-value":true,"String-value":"content","bool-value":false,"String-value":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"},{"__type":"Pointer","className":"_User","objectId":"content"}],"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":"content","String-value":"content","String-value":"content","String-value":"content",”pointer”:{"__type":"Pointer","className":"content","objectId":"content"},"String-value":"content","createdAt":"content","updatedAt":"content","String-value":"content","bool-value":true,"bool-value":true,"bool-value":true,"pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"String-value":{"__op":"Delete"},"String-value":{"__op":"Delete"},"pointer":{"__op":"Delete"},"String-value":{"__op":"Delete"},”String-value":"content"} RESPONSE CHECK OUT KID: (Client-side, no error - Still has DeleteOperation){"String-value":"content","String-value":"content","bool-value":"true","String-value":"content","String-value":"content","String-value":"com.parse.ParseDeleteOperation@427557f8","bool-value":"true","ACL":"com.parse.ParseACL@42dffad0","String-value":"content","pointer":{“_User”},"pointer":{"_User"},"bool-value":"false","String-value":"content","DATE-value":"content","bool-value":"true","bool-value":"true","bool-value":"false","pointer":{"anotherObject"}, ResultThis does not work. Instead of containing null the updated object still has ParseDeleteOperation in it's fields, when setting remove on a field before saving object. Other fields are updated and Dashboard displays correct values ( (undefined) for the deleted value(s) in field) Removing Cloud-code before- and aftersave resolves this issue. Issue only occurs when trying to delete value in a field. Update works as it should. Please get back if you need some further data for debugging the issue |
I'm running into this on both platforms I use (iOS and in JS) when I |
We used a workaround of |
@dbarabander Thanks for the heads up! I'll give that a try. |
@airdrummingfool my pleasure |
@dbarabander I tried |
So after updating to the latest server-version everything on iOS works great! There's still an issue on the android side though. When removing a value of a field on the android side the __op: Delete is still there in afterSave and the updated object in the saveCallback still has it. Not for the iOS side. This is the server log for running the same save-operation for Android and iOS using .remove('key') and .removeObjectForKey() AndroidBF SAVE KID REQ (has __op:Delete){"String-value":"content","DATE-value":"DATE","String-value":"content ","String-value":"content","pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"bool-value":true,"String-value":"content","String-value":"content","bool-value":true,"String.value":"content","String-value":{"__op":"Delete"},"bool-value":true,"DATE":{"__type":"Date","iso":"content"},"String-value":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"}],"String-value":"content","pointer":{"__op":"Delete"},"number-value":3,"pointer":{"__type":"Pointer","className":"className","objectId":"content"},"String-value":"content","bool-value":true,"ACL":{"ROLES"},"DATE-value":"DATE","String-value":"content ","bool-value":false,"array-value":[array],"bool-value":false,"String-value":"content"} AF SAVE KID REQ (Still has __op:Delete){"String-value":"content","DATE-value":"DATE","String-value":"content ","String-value":"content","pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"bool-value":true,"String-value":"content","String-value":"content","bool-value":true,"String.value":"content","String-value":{"__op":"Delete"},"bool-value":true,"DATE":{"__type":"Date","iso":"content"},"String-value":"content","pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"}],"String-value":"content","pointer":{"__op":"Delete"},"number-value":3,"pointer":{"__type":"Pointer","className":"className","objectId":"content"},"String-value":"content","bool-value":true,"ACL":{"ROLES"},"DATE-value":"DATE","String-value":"content ","bool-value":false,"array-value":[array],"bool-value":false,"String-value":"content"} iOSBF SAVE KID REQ (has __op:Delete){"String-value":"content","DATE-value":"DATE","String-value":"content","String-value":"content","String-value":"content","pointer-value":{"__type":"Pointer","className":"_User","objectId":"content"},"bool-value":true,"String-value":"content","String-value":"content","bool-value":false,"String-value":"content","String-value":{"__op":"Delete"},"bool-value":true,"DATE-value":{"DATE"},"pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"}],"String-value":"content","pointer":{"__op":"Delete"},"number-value":3,"pointer":{"__type":"Pointer","className":"className","objectId":"content"},"String-value":"content","bool-value":true,"ACL":{"ROLES"} "DATE-value":"DATE","File-value":{"FILE-URL"},"bool-value":false,"bool-value":false,"String-value":"content"} AF SAVE KID REQ (No __op:Delete){"String-value":"content","DATE-value":"DATE","String-value":"content","String-value":"content","String-value":"content","pointer":{"__type":"Pointer","className":"_User","objectId":"content"},"bool-value":true,"String-value":"content","String-value":"content","bool-value":false,"String-value":"content","bool-value":true,"DATE-value":{"DATE"},"pointer-array":[{"__type":"Pointer","className":"_User","objectId":"content"}],"String-value":"content","number-value":3,"pointer":{"__type":"Pointer","className":"className","objectId":"content"},"String-value":"content","bool-value":true,"ACL":{"ROLES"},"DATE-value":"DATE","File-value":{"FILE-URL"},"bool-value":false,"bool-value":false,"String-value":"content"} |
@pargu just to be clear, what version is that? did you pull directly from github or are you using the one in npm? |
@peeinears We're using 2.2.11 pulled from github and android sdk version (1.13.0) |
…ons to SDKs (#1946) * Adding a test demonstrating issue #1840. * Fixes #1840 * Adds failing test with other use case - That test fails on parse.com as well * Bumps parse to 1.9.0 * exclude pg db * Exclude pg on other test * Adds clientSDK compatibility check for forward deletion - Mark js1.9.0 as compatible * Strips all operations from result - fix for #1606
… delete operations to SDKs (parse-community#1946) * Adding a test demonstrating issue parse-community#1840. * Fixes parse-community#1840 * Adds failing test with other use case - That test fails on parse.com as well * Bumps parse to 1.9.0 * exclude pg db * Exclude pg on other test * Adds clientSDK compatibility check for forward deletion - Mark js1.9.0 as compatible * Strips all operations from result - fix for parse-community#1606
… delete operations to SDKs (parse-community#1946) * Adding a test demonstrating issue parse-community#1840. * Fixes parse-community#1840 * Adds failing test with other use case - That test fails on parse.com as well * Bumps parse to 1.9.0 * exclude pg db * Exclude pg on other test * Adds clientSDK compatibility check for forward deletion - Mark js1.9.0 as compatible * Strips all operations from result - fix for parse-community#1606
Reproduce:
Hacks
The text was updated successfully, but these errors were encountered: