-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
When creating and then destroying an object in S3, calling exists? on that object raises a uninitialized constant Aws::Client::Errors error
I've tested the following code on mri 2.2.3 and jruby-9.0.1.0, and it doesn't produce an error. Perhaps its a bug specific to jruby-9.0.5.0 or maybe your const_get call is buggy?
Sample Code To Reproduce Error:
require 'aws-sdk'
def aws_creds
id = ENV['AWS_ACCESS_KEY_ID']
secret = ENV['AWS_SECRET_ACCESS_KEY']
Aws::Credentials.new(id, secret)
end
def aws_region
ENV['AWS_REGION']
end
def bucket_name
ENV['S3_BUCKET']
end
Aws.config.update({
region: aws_region,
credentials: aws_creds
})
body = 'My test string - should be deleted!'
key = 'test_upload/destroy.txt'
bucket = Aws::S3::Resource.new.bucket(bucket_name)
obj = bucket.object(key)
obj.put(body: body)
bucket.object(key).delete
key_exists = bucket.object(key).exists?
puts "Does key: #{key} exist in bucket: #{bucket_name}?"
puts key_existsGemfile:
source 'https://rubygems.org'
ruby '2.2.3', engine: 'jruby', engine_version: '9.0.5.0'
#ruby=jruby-9.0.5.0
gem 'aws-sdk', '2.1.15'Backtrace:
NameError: uninitialized constant Aws::Client::Errors
const_missing at org/jruby/RubyModule.java:3212
const_get at org/jruby/RubyModule.java:3152
error at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/xml/error_handler.rb:25
block in call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/xml/error_handler.rb:9
call at org/jruby/RubyProc.java:318
block in on at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/response.rb:43
block in on_success at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/http/response.rb:139
call at org/jruby/RubyProc.java:318
block in listener at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/http/response.rb:166
call at org/jruby/RubyProc.java:318
on_done at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/http/response.rb:130
on_success at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/http/response.rb:137
on at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/response.rb:42
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/xml/error_handler.rb:8
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_request_signer.rb:64
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_redirects.rb:15
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/retry_errors.rb:87
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_md5s.rb:33
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_expect_100_continue.rb:21
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_bucket_dns.rb:31
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/rest/handler.rb:7
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/user_agent.rb:12
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/plugins/endpoint.rb:41
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/param_validator.rb:21
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:18
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/plugins/param_converter.rb:20
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/plugins/response_target.rb:21
send_request at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/seahorse/client/request.rb:70
send_request at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/poller.rb:61
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/poller.rb:47
block in poll at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/waiter.rb:104
loop at org/jruby/RubyKernel.java:1287
poll at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/waiter.rb:101
block in wait at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/waiter.rb:91
catch at org/jruby/RubyKernel.java:1096
block in wait at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/waiter.rb:90
catch at org/jruby/RubyKernel.java:1096
wait at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/waiters/waiter.rb:89
wait_until at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-core-2.2.15/lib/aws-sdk-core/client_waiters.rb:110
call at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-resources-2.2.15/lib/aws-sdk-resources/operations.rb:214
block in wait_until_exists at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-resources-2.2.15/lib/aws-sdk-resources/operation_methods.rb:19
exists? at /Users/cmullen/.rvm/gems/jruby-9.0.5.0/gems/aws-sdk-resources-2.2.15/lib/aws-sdk-resources/resource.rb:131
<top> at test.rb:31
Metadata
Metadata
Assignees
Labels
No labels