GithubHelp home page GithubHelp logo

Comments (12)

ridergeek avatar ridergeek commented on July 20, 2024

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.

danrobinson avatar danrobinson commented on July 20, 2024

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.

ridergeek avatar ridergeek commented on July 20, 2024

Hi Dan - here's some additional detail:

  1. beforeSave works if I use REST/CURL (JSSDK 1.5.0 and latest)
  2. beforeSave works if I update an existing record with IOS or Android (JSSDK 1.5.0 and latest)
  3. beforeSave works if I update via browser (JSSDK 1.5.0 and latest)
  4. beforeSave works if I add a new record using IOS or Android (JSSDK 1.5.0)
  5. 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.

ridergeek avatar ridergeek commented on July 20, 2024

By "fails", I mean all the fields get changed to undefined.

from parse-sdk-js.

danrobinson avatar danrobinson commented on July 20, 2024

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.

andrewimm avatar andrewimm commented on July 20, 2024

@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.

andrewimm avatar andrewimm commented on July 20, 2024

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.

parse-github-bot avatar parse-github-bot commented on July 20, 2024

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:

from parse-sdk-js.

ridergeek avatar ridergeek commented on July 20, 2024

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.

danrobinson avatar danrobinson commented on July 20, 2024

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.

jdee avatar jdee commented on July 20, 2024

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.

ridergeek avatar ridergeek commented on July 20, 2024

+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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.