fake-s3 icon indicating copy to clipboard operation
fake-s3 copied to clipboard

No objects after restart of fakes3

Open thekorn opened this issue 12 years ago • 5 comments

I'm using HEAD of fakes3, and whenever I restart the fakes3 server lookinng up keys is not working anymore, I always get an empty list of objects for each bucket.

thekorn avatar Jan 05 '13 18:01 thekorn

I needed to patch fake-s3 to handle a case that led to same exact behavior:

https://github.com/robguttman/fake-s3/commit/7bfc57ede19466d6b6be489b30557be7d6f610f7

May or may not be your problem though.

  • Rob

On Jan 5, 2013, at 1:25 PM, Markus Korn [email protected] wrote:

I'm using HEAD of fakes3, and whenever I restart the fakes3 server lookinng up keys is not working anymore, I always get an empty list of objects for each bucket.

— Reply to this email directly or view it on GitHub.

robguttman avatar Jan 05 '13 18:01 robguttman

I'm seeing the exact same problem using the AWS-S3 ruby gem. Everything works great, but after server restart I get "AWS::S3::NoSuchKey ". Checking the fakes3 folder, the files are there.

The proposed patch is not working.

Any ideas on what could cause this?

  • Rune

runemadsen avatar Jan 29 '13 20:01 runemadsen

I worked around this locally with the following changes in lib/fakes3/file_store.rb:

19c19
<         bucket_obj = Bucket.new(bucket_name,Time.now,[])
---
>         bucket_obj = Bucket.new(bucket_name,Time.now,get_objects(bucket_name, bucket))
199a200,206
> 
>   private
>     def get_objects bucket_name, path
>       Dir[File.join(path, '*')].map do |filepath|
>         get_object(bucket_name, File.basename(filepath), nil)
>       end
>     end

dterhorst-zz avatar Jan 24 '14 19:01 dterhorst-zz

I just had the same problem - objects are no longer listed after restarting the server, although I can still GET them. I applied the fix from dterhorst and it worked. This would be a good pull request.

mark2997 avatar Sep 08 '14 12:09 mark2997

I had to use a combination of fixes here to get it working in my fork:

https://github.com/saltzmanjoelh/fake-s3

saltzmanjoelh avatar Sep 14 '16 19:09 saltzmanjoelh