Comments (12)
Here's the log output when I use beforeSave. The "update changed to {}" is what baffles me.
I2015-09-23T23:05:51.493Z]v85 before_save triggered for chart for user YUUdJazO4j:
Input: {"original":null,"update":{"ACL":{"YUUdJazO4j":{"read":true,"write":true}},"designer":{"__type":"Pointer","className":"designer","objectId":"sl5smLJb2A"},"name":"BeforeSaveTest","notes":"","owner":{"__type":"Pointer","className":"_User","objectId":"YUUdJazO4j"}}}
Result: Update changed to {}
I2015-09-23T23:05:51.529Z]Running beforesave
from parse-sdk-js.
This isn't happening for me with version 1.6.2 in either node or the browser.
Here's my log output when I try to replicate:
I2015-09-27T19:20:26.892Z]v37 before_save triggered for chart for user UTsoNVljmJ:
Input: {"original":null,"update":{"ACL":{"UTsoNVljmJ":{"read":true,"write":true}},"designer":{"__type":"Pointer","className":"designer","objectId":"iTe5InCIij"},"name":"BeforeSaveTest","notes":"","owner":{"__type":"Pointer","className":"_User","objectId":"UTsoNVljmJ"}}}
Result: Update changed to {"ACL":{"UTsoNVljmJ":{"read":true,"write":true}},"designer":{"__type":"Pointer","className":"designer","objectId":"iTe5InCIij"},"name":"BeforeSaveTest","notes":"","owner":{"__type":"Pointer","className":"_User","objectId":"UTsoNVljmJ"}}
I2015-09-27T19:20:26.912Z]Running beforesave
from parse-sdk-js.
Hi Dan - here's some additional detail:
- beforeSave works if I use REST/CURL (JSSDK 1.5.0 and latest)
- beforeSave works if I update an existing record with IOS or Android (JSSDK 1.5.0 and latest)
- beforeSave works if I update via browser (JSSDK 1.5.0 and latest)
- beforeSave works if I add a new record using IOS or Android (JSSDK 1.5.0)
- beforeSave fails if I add a new record with IOS or Android (JSSDK latest)
I originally opened an issue for Android-SDK but found the same issue with IOS and realized the problem goes away when I use JSSDK 1.5.0.
from parse-sdk-js.
By "fails", I mean all the fields get changed to undefined.
from parse-sdk-js.
Doesn't seem to happen for me; maybe the Parse devs will have a better idea. Have you tried running it with only this function and no other cloud code? Are you sure the code is exactly this:
Parse.Cloud.beforeSave("chart", function(request, response) {
console.log("Running beforesave")
response.success()
});
Maybe you could upload a reproducible example?
from parse-sdk-js.
@ridergeek can you tell me what version of the JS SDK is hardcoded into your config/global.json
file when you encounter this problem? We're trying to track down an issue where cloud code sometimes doesn't recognize that 1.6.2 is the "latest" version.
from parse-sdk-js.
and 👍 to what @danrobinson said: Reproducible test cases are what we need for solving bug reports. Otherwise, it's difficult to replicate a variety of environmental factors.
I really appreciate that you've broken down the success/failure cases above, but I still need a bit more info
from parse-sdk-js.
Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.
Please try the latest SDK. Our release notes have details about what issues were fixed in each release.
In addition, you might find the following resources helpful:
- Documentation: https://www.parse.com/docs
- Google Groups: https://groups.google.com/forum/#!forum/parse-developers
- Stack Overflow: http://stackoverflow.com/tags/parse.com
from parse-sdk-js.
https://dl.dropboxusercontent.com/u/13394990/beforesavebug.zip
Here's an example project that duplicates the problem. I included the cloud code too.
Just change the application and client keys to a valid project in appdelegate.swift before you run.
from parse-sdk-js.
Can confirm this behavior (had tried client code version 1.6.2 but not Cloud Code version 1.6.2; sorry @ridergeek). It happens whenever beforeSave is run on an update (whether a new record or an existing record) that includes a change to the ACL. No matter what is in the beforeSave code, the update will become {} (so it doesn't change anything). It happens with "jssdk" set to either "1.6.2" or "latest".
Here's a minimal example in Node: https://github.com/danrobinson/beforesavebug
The devs will have to help since this seems to be a problem with beforeSave, which like the other server-side JS code isn't in this repository.
Edit: Opened a bug report: https://developers.facebook.com/bugs/169407843399759/. I see that you previously opened one but closed it to ask it on the Android SDK github. At the risk of going around in circles I think it probably belongs on the bug report site.
from parse-sdk-js.
Glad to see this will be fixed in 1.6.5. I downgraded to 1.5 for now, but I wonder if useMasterKey() in the beforeSave hook would work around the issue temporarily.
from parse-sdk-js.
+1 on the glad this is fixed in 1.6.5! I tried to use master key but it didn't help. I think the only workaround (I haven't tested this) would be to not set an ACL before you save. You save the object without an ACL and then use beforeSave or afterSave to set the desired ACL. Again, just a theory.
from parse-sdk-js.
Related Issues (20)
- Parse.Cloud.httpRequest is not a function HOT 2
- saveEventually - "code":209,"stack":"Error: Session token is expired" HOT 7
- Expand TypeScript support HOT 9
- Lock closed threads HOT 1
- saveEventually / EventuallyQueue doesn't work when killing server -> saveEventually object -> restarting server HOT 4
- API Reference Documentation not updated HOT 1
- SDK throws error in web contexts where calling into `window.indexedDB` is prohibited, but not undefined on the window HOT 2
- Calling `.add` multiple times on relations is broken HOT 4
- Refused to get unsafe header "access-control-expose-headers" on Chrome HOT 17
- Allow for REST Content Override for Server protection HOT 2
- Align currently supported Node.js version HOT 4
- `Parse.User.verifyPassword` does not pass request options to server HOT 5
- Parse SDK 4.3.1 is not working with React Native / Expo HOT 9
- Expo RN and ParseLiveQuery EventEmitter error HOT 13
- Cannot set ACL from JSON HOT 1
- Infinite loop in `encode.js` HOT 5
- Missing test for `Parse.User.verifyPassword` option `ignoreEmailVerification` HOT 2
- `Parse.Object.set` sliently handles validation errors HOT 1
- TypeError: attempted to use private field on non-instance, js engine: hermes HOT 3
- Installation support for JS SDK HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-sdk-js.