Aws-sdk-ruby: aws-sdk-elasticloadbalancingv2 v1.40.0 with aws-sdk-core v3.90.1 fails to load with "cannot load such file -- aws-sdk-core/plugins/client_metrics.rb"

Created on 29 Feb 2020  路  7Comments  路  Source: aws/aws-sdk-ruby

Describe the bug

Trying to require the latest version of aws-sdk-elasticloadbalancingv2 fails.

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

  • aws-sdk-elasticloadbalancingv2 v1.40.0
  • aws-sdk-core v3.90.1

Both are the latest versions of the respective gems as of this writing.

Version of Ruby, OS environment

$ ruby -v
ruby 2.6.5p114 (2019-10-01) [x86_64-linux]

To Reproduce (observed behavior)

With a Gemfile like:

source 'https://rubygems.org'                                                                                     

gem 'aws-sdk-core', '3.90.1'                                                                                      
gem 'aws-sdk-elasticloadbalancingv2', '1.40.0' 

Install the gems and require aws-sdk-elasticloadbalancingv2 in irb:

$ bundle install
...
$ irb
>> require "aws-sdk-elasticloadbalancingv2"
Traceback (most recent call last):
       12: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/bin/irb:23:in `<main>'
       11: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/bin/irb:23:in `load'
       10: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        9: from (irb):1
        8: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:156:in `require'
        7: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:168:in `rescue in require'
        6: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:168:in `require'
        5: from /home/$REDACTED/.gem/ruby/2.6.0/gems/aws-sdk-elasticloadbalancingv2-1.40.0/lib/aws-sdk-elasticloadbalancingv2.rb:13:in `<top (required)>'
        4: from /home/$REDACTED/.gem/ruby/2.6.0/gems/aws-sdk-elasticloadbalancingv2-1.40.0/lib/aws-sdk-elasticloadbalancingv2.rb:13:in `require_relative'
        3: from /home/$REDACTED/.gem/ruby/2.6.0/gems/aws-sdk-elasticloadbalancingv2-1.40.0/lib/aws-sdk-elasticloadbalancingv2/client.rb:24:in `<top (required)>'
        2: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        1: from /nix/store/6zchw55armvq05zplr45fq1cgibd7cff-ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
LoadError (cannot load such file -- aws-sdk-core/plugins/client_metrics.rb)

The aws-sdk-core/plugins directory of v3.90.1 has client_metrics_plugin.rb, not client_metrics.rb:

$ basename -a ~/.gem/ruby/2.6.0/gems/aws-sdk-core-3.90.1/lib/aws-sdk-core/plugins/client_metrics* 
client_metrics_plugin.rb
client_metrics_send_plugin.rb

Expected behavior

require succeeds.

Additional context

This commit renamed aws-sdk-core/plugins/client_metrics_plugin.rb to aws-sdk-core/plugins/client_metrics.rb:
https://github.com/aws/aws-sdk-ruby/pull/2235/commits/7505fb0b52f773041c6a06ec780cd4b1d470291a#diff-243fd2b461c321a15777dfc5e30c4905

aws-sdk-elasticloadbalancingv2 (v1.40.0)'s client.rb tries to require aws-sdk-core/plugins/client_metrics.rb, while aws-sdk-core v3.90.1 still has the old file client_metrics_plugin.rb (Link to rubydocs.info's page of that module, which shows the source path)

Workaround

Pin aws-sdk-elasticloadbalancingv2 to 1.39.0.

Most helpful comment

gem install aws-sdk succeeds now.

I was able to require all gems:

Gem::Specification.map {|a| a.name}.each do |gem|
  next unless gem.start_with?('aws-sdk')
  require gem
  puts "required: #{gem}"
end

I'm very sorry about this. I was not careful enough, and I will own the mistake here.

All 7 comments

I got the same error :(

And same issue here: aws.sdk-elasticloadbalancingv2 v1.40.0 attempts to pull in client_metrics.rb, but the most recent aws-sdk-core v3.90.1 provides client_metrics_plugin.rb.

Same issue.

I assembled a list of aws-sdk's which are currently affected by this issue:

aws-sdk-appmesh
aws-sdk-augmentedairuntime
aws-sdk-codeguruprofiler
aws-sdk-configservice
aws-sdk-elasticloadbalancingv2
aws-sdk-globalaccelerator
aws-sdk-glue
aws-sdk-lightsail
aws-sdk-quicksight
aws-sdk-workdocs

Sorry about this. Investigating.

I've started yanking the offending gems. A new version of core was not published.

gem install aws-sdk succeeds now.

I was able to require all gems:

Gem::Specification.map {|a| a.name}.each do |gem|
  next unless gem.start_with?('aws-sdk')
  require gem
  puts "required: #{gem}"
end

I'm very sorry about this. I was not careful enough, and I will own the mistake here.

Was this page helpful?
0 / 5 - 0 ratings