Closed dinukarajapaksha closed 3 months ago
I'm not able to reproduce this. My script output is:
core version: 3.201.0
ssm version: 1.173.0
ruby version: 2.7.8
(minor ruby version shouldn't matter here) and my script is:
require "bundler/inline"
require "json"
gemfile do
source "https://rubygems.org"
gem "nokogiri"
gem "aws-sdk-core"
gem "aws-sdk-ssm"
gem "thor"
end
require 'aws-sdk-ssm'
client = Aws::SSM::Client.new
commands = client.list_commands
puts "core version: #{Aws::CORE_GEM_VERSION}"
puts "ssm version: #{Aws::SSM::GEM_VERSION}"
puts "ruby version: #{RUBY_VERSION}"
Based on a warning I see running this in Ruby 3+, is it possible that you don't have bigdecimal available? Try adding bigdecimal to your gemfile?
I'm not able to reproduce this. My script output is:
core version: 3.201.0 ssm version: 1.173.0 ruby version: 2.7.8
(minor ruby version shouldn't matter here) and my script is:
require "bundler/inline" require "json" gemfile do source "https://rubygems.org" gem "nokogiri" gem "aws-sdk-core" gem "aws-sdk-ssm" gem "thor" end require 'aws-sdk-ssm' client = Aws::SSM::Client.new commands = client.list_commands puts "core version: #{Aws::CORE_GEM_VERSION}" puts "ssm version: #{Aws::SSM::GEM_VERSION}" puts "ruby version: #{RUBY_VERSION}"
Based on a warning I see running this in Ruby 3+, is it possible that you don't have bigdecimal available? Try adding bigdecimal to your gemfile?
Tried this but still fails
Can you try upgrading your ruby version or cleaning your gem environment?
The code it's ultimately failing on is this:
def load_engine(name)
require "aws-sdk-core/cbor/#{name}_engine"
const_name = name[0].upcase + name[1..-1] + 'Engine'
const_get(const_name)
end
This file should exist in the latest core - it should look for "cbor_engine". My best guess is that maybe you are monkey patching or messing with load paths and it can't find this? Is service_list
your script?
Another thing to try is change the gem source code locally to do a print statement or byebug statement here and check the load paths and presence of this file. Since you are the only one to report this and I can't reproduce it, it's likely something environment related.
The code it's ultimately failing on is this:
def load_engine(name) require "aws-sdk-core/cbor/#{name}_engine" const_name = name[0].upcase + name[1..-1] + 'Engine' const_get(const_name) end
This file should exist in the latest core - it should look for "cbor_engine". My best guess is that maybe you are monkey patching or messing with load paths and it can't find this? Is
service_list
your script?Another thing to try is change the gem source code locally to do a print statement or byebug statement here and check the load paths and presence of this file. Since you are the only one to report this and I can't reproduce it, it's likely something environment related.
I tried executing the same script with the official ruby 2.7 Docker image and it showed no errors. I guess it has to be something to do with the packages in our image but I'm not exactly sure why it is failing with the SDK version.
we are building the Docker file similar to this
FROM hashicorp/terraform:0.14.11
ENV GEM_HOME="/usr/local/bundle"
ENV PATH $GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH
RUN apk --no-progress --quiet add --update --no-cache ca-certificates jq ruby ruby-etc ruby-json build-base ruby-dev py3-pip bash
Then at the runtime run gem install bundler -v '~> 2.1.4' --no-doc
In this environment the SDK fails with the cbor lib location error. Appreciate if you can point out anything we are doing wrong here @mullermp. But I'll be closing this issue for now and thank you for the support given.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Describe the bug
We are using inline bundler with the following gems
The
aws-sdk-core
gem version later than 3.198.0 there is a CBOR library compatibility error.Expected Behavior
There shouldn't be any breaking changes from
3.198.0
to later minor releasesCurrent Behavior
When the inline script is executed it generates the following error
Reproduction Steps
Run a inline script with both
aws-sdk-core
aws-sdk-ssm
in bundler 2.1.4Possible Solution
We temporarily fixed this by locking the version on the script. But this is causing some other BAU to not function as expected.
Additional Information/Context
We expect to have a minor release compatibility over the versions
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-core
Environment details (Version of Ruby, OS environment)
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux-musl]