Closed Dagnan closed 9 years ago
It's going to be difficult to debug with the info you've provided. I'm not sure if it's a bug.
Hi guys, I faced the same issue. Created a new bucket via CyberDuck app, the file is present in the bucket. When I try to fetch it with s3 gem, it returns this error.
UPD: it seems to be some issue with S3 service, the error disappeared suddenly, without any fix. Looks like S3 returns empty response for request to this bucket.
This should be fixed in master, please try again, and let me know if it doesnt work. thanks
Getting the exact same error.
created a bucket, added a single file.
bucket.objects.first.content => actual file content
bucket.objects.first.key => actual file key
bucket.objects.first.request_acl => {"my s3 user"=>"FULL_CONTROL", "Everyone"=>"READ"}
bucket.objects.first.retrieve => NoMethodError: undefined method `to_hash' for nil:NilClass
precisely according to Dagnan's stacktrace above. The object_request for headers returns nil. (I guess, boiling down to the Connection.request method, and possibly an empty response from s3)
It's indeed fixed in master. It'd be nice to see this change propagated to rubygems.
@qoobaa can you add me to rubygems so I can cut a new gem. thanks
@arthurnn done.
new version released https://rubygems.org/gems/s3/versions/0.3.22
I am facing the same problem.
I have a working S3 bucket with files, and the bucket.objects method manages to correctly list my files, and get their contents, but is unable to retrieve them.
Example of output from the Rails console:
2.3.0 :009 > bucket
=> #<S3::Bucket:kyouko>
2.3.0 :010 > bucket.objects[125]
=> #<S3::Object:/kyouko/anime/147799.jpg>
2.3.0 :011 > bucket.objects[125].retrieve
NoMethodError: undefined method 'to_hash' for nil:NilClass
Did you mean? to_h
from /home/rd/.rvm/gems/ruby-2.3.0/gems/s3-0.3.24/lib/s3/object.rb:245:in 'parse_headers'
from /home/rd/.rvm/gems/ruby-2.3.0/gems/s3-0.3.24/lib/s3/object.rb:190:in 'object_headers'
from /home/rd/.rvm/gems/ruby-2.3.0/gems/s3-0.3.24/lib/s3/object.rb:61:in 'retrieve'
Using the 'find' method also causes this problem, since it uses the 'retrieve' method. Same for 'exists?' which is actually the method I need to use in the first place. I am using v0.3.24. I thought this was fixed? Or is it another problem?
+1 on this issue
Hi.
When I do a simple object.build(my_key) and object.retrieve I get:
Seems simple but not sure if it's a bug or me using the gem wrong.