parse-community/parse-php-sdk

Cloud code error

YousefAlsbaihi opened this issue · 3 comments

Issue Description

i'm using parse cloud code to update the user informations using this code below

var SaveObject = Parse.Object.extend(Parse.User);
  var saveObject = new Parse.Query(SaveObject);
  saveObject.equalTo("username", "sam");
  saveObject.first({
    useMasterKey: true,
    success: function(Objects) {
      Objects.save(null, {
        useMasterKey: true,
        success: function(object) {
          object.set("foo":"bar");
          object.save();
          response.success('SUCCESS');
        }
      });
    }
  });

but i still getting the error in php sdk

<br /> <b>Notice</b>: Undefined index: result in <b>/php/vendor/parse/php-sdk/src/Parse/ParseCloud.php</b> on line <b>39</b><br />

Note: i tried every answer that has been posted regard to parse cloud code on here, i couldn't find any answer that can solve this problem.

using PHP V. 7.3.8
Parse Server V.3.9.0
Parse PHP SDK V.1.6.*

Can you please share the PHP code that you are using to call the function and also the complete function with the Parse.Cloud.define() clause? Also note that, since you are using 3.9, you need to write your function using the async style: https://github.com/parse-community/parse-server/blob/master/3.0.0.md#migrating-functions

I think my issue #483 is linked to this one.

Because the run function always try to return $response['result']

return ParseClient::_decode($response['result']);

In case you have an error while calling the function (for example you try to call a cloud function that doesn't exist), you won't received a "result" object and you will get a Undefined index: result error.

I'm closing this as it lacks essential information required to investigate the issue. @YousefAlsbaihi please follow up on any questions asked and we can re-open this issue.