aws-sdk-ruby: AWS::S3::Errors::BadRequest when calling S3Object#exists?

Using 1.32.0, ruby 1.9.3-p484

Doesn’t seem like calling exists? on an object should be raising an error like this?

Portion of the backtrace included:

  • “…/shared/bundle/ruby/1.9.1/gems/aws-sdk-1.32.0/lib/aws/core/client.rb:368:in return_or_raise’”,
  • “…/shared/bundle/ruby/1.9.1/gems/aws-sdk-1.32.0/lib/aws/core/client.rb:469:in client_request’”, “(eval):3:in `head_object’”,
  • “…/shared/bundle/ruby/1.9.1/gems/aws-sdk-1.32.0/lib/aws/s3/s3_object.rb:293:in head’”,
  • “…/shared/bundle/ruby/1.9.1/gems/aws-sdk-1.32.0/lib/aws/s3/s3_object.rb:270:in exists?'”

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

I realize this is an old issue, but I found that being explicit about the region to fix the problem for us.

We were getting the AWS::S3::Errors::BadRequest for every call to .exist?. Our bucket was in us-east-2, and was somehow working without specifying the region. Once we passed region into the S3 client, all was well.