I seem to have found a breaking change when trying to move to V3 of the SDK (or maybe I'm missing something)
In SDK 2.11.110, the following seems to be working just fine
Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])
In SDK 3.22.0 it throws the following exception:
PATH/gems/aws-sdk-s3-1.17.0/lib/aws-sdk-s3/bucket.rb:666:in `extract_name': missing required option :name (ArgumentError)
from PATH/aws-sdk-s3-1.17.0/lib/aws-sdk-s3/bucket.rb:21:in `initialize'
from PATH/aws-sdk-s3-1.17.0/lib/aws-sdk-s3/resource.rb:69:in `new'
from PATH/aws-sdk-s3-1.17.0/lib/aws-sdk-s3/resource.rb:69:in `bucket'
from PATH/config/initializers/aws.rb:6:in `<main>'
@softwaregravy The code works for me for both v2 and v3, may I ask is the environment having 'S3_BUCKET' value when you are running v3 code?
huh. Everything is the same. I can cause the exception and remove it simply by changing my gemfile.
I'll try and make a one-off example that breaks to rule out anything else in my project interfering.
I have created a dummy project that can recreate the issue
it was still breaking in my reproduction app, but the problems suddenly topped. I can't explain. I guess we'll just assume user error for now
@softwaregravy,
Thanks for attempting to reproduce the issue. If you do come up with something consistent, let us know.
same here:
remote: /tmp/build_74b73bbb3a0bbda69735e5e6629ed48c/vendor/bundle/ruby/2.6.0/gems/aws-sdk-s3-1.36.0/lib/aws-sdk-s3/bucket.rb:685:in extract_name': Cannot loadRails.config.active_storage.service`: (ArgumentError)
remote: missing required option :name
try not using ENV['S3_BUCKET'] and instead replacing it with the actual string value that was stored in that environment variable. That fixed the issue for me.
ENV['S3_BUCKET'] => whatever-this-value-really-is
@davidlcorbitt that worked for me!
Most helpful comment
try not using ENV['S3_BUCKET'] and instead replacing it with the actual string value that was stored in that environment variable. That fixed the issue for me.
ENV['S3_BUCKET']=>whatever-this-value-really-is