简体   繁体   中英

Parse.com Failed to create new object, with error code: object not found for update / delete

I'm trying to update or delete some objects. Both in my php script and in the parse cloud I'm getting the message "object not found for update" (php) and "object not found for update" in the afterSave cloud function.

php code sample:

$video = $results[0];

echo("found: " . count($results)); //this works
echo("found: " . $video->getObjectId()); //this works

$video->set("thumbnail", $file); //The file exists
$video->save();

parse aftersave function code sample:

}).then(function(buffer) {

        var base64 = buffer.toString("base64");
        var cropped = new Parse.File("thumbnail", { base64: base64 });
        return cropped.save();

    }).then(function(cropped) {

        video.set("thumbnail", cropped);
        video.save(null, {
            success: function(video) {

                console.log('Updated objectId: ' + video.id);
            },
            error: function(video, error) {

                console.log('Failed to create new object, with error code: ' + error.message);
            }
            });

    }).then(function(result) {

I'm I doing something wrong?

PS: The object was created/duplicated 4 times by the parse cloud afterSave function.

It looks like you have many objects being saved. Which one is saving/duplicating?

It also looks like video is not defined in this context. Is it defined further up as a function variable?

You either need to pass in video alongside cropped or define it in the parent function.

If you are creating a new video you will need to use

var video = new Parse.File(...

as you have done with cropped

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM