Parse.com无法创建新对象,错误代码:找不到更新/删除对象

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