ZF-7199: Objects are never removed from S3

Description

I am not sure if this is really a sub-task. But when I try to DELETE objects from one of my buckets (that are all located in the EU), then I get a positive response-message from S3. But the objects are still there. I guess the problem is that the function first tries to DELETE the object from my bucket (assuming that it is located in the US). But Amazon's API even returns a positive response when you try to delete an object that does not even exist (in this location). And that is why the DELETE does never reach the correct location (in EU). I did not test other operations, yet. But wouldn't it be better to give the location to Zend_Service_Amazon_S3 as a parameter?

Comments

Assigning to Stas.

You can specify the location when creating the bucket. But Amazon API doesn't have any means to specify location on deletion. Could you provide the exact sequence of actions (since the bucket creation) that you performed to lead to this problem?

Well, first I created the bucket using the Firefox extension S3Fox. Then I have an upload-method in my code, that looks like this:



 if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
            $sucess = $s3->putFile($media_file, 'ictv/'.$this->getClientid().'/media/'.$this->getMediatype().'/'.$this->getPath(), 
                            array(Zend_Service_Amazon_S3::S3_ACL_HEADER =>
                                  Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
            $logger->info(Zend_Debug::dump($sucess, 'ret', false));
            //jetzt das urspr√ľngliche medium im temp-ordner l√∂schen:
            @unlink($media_file);
            
        } 

(Sorry for the double-post...)

Well, first I created the bucket using the Firefox extension S3Fox. Then I have an upload-method in my code, that looks like this:


$media_file = 'path/to/my/file';
if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
      $sucess = $s3->putFile($media_file, $bucket_name.'/media/'.$media_file_name, 
    array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
    @unlink($media_file);           
}

After that my file is at the right place in my bucket and it is public readable and I can use it. But when I want to delete it, I do the following in my deleting-method:


$s3_media_file = $bucket_name.'/media/'.$media_file_name;
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
$response = $s3->removeObject($s3_media_file);

Then I get the right response from S3 but my object is still there...

Does it happen with any objects at all or just specific ones (i.e. if you just create $bucket_name."/test" is it deleted)? Does it happen for you only with EU-based buckets?

I am now a little bit confused.... My buckets were not available for about one hour or more yesterday and now it all works fine. Can it be, that this could have been an amazon-error or something? Does anybody else have a similar problem?