aws-sdk-ruby: AWS-SDK-SSM Compilation error during boot time

Describe the bug

We are randomly getting this error while running our app in staging/production.

Note that we use bootsnap from Shopify - https://github.com/Shopify/bootsnap to compile_cache_iseq & compile_cache_yaml

This started when we upgraded aws-sdk-ssm from 1.147.0 to 1.148.0 2 weeks ago.

Stacktrace from our log

  | 2023-02-14T15:04:39.085-05:00 | NoMethodError: undefined method `struct_class=' for #<Seahorse::Model::Shapes::StringShape:0x00007fe49a16d6c8 @metadata={}, @name="DocumentName">
-- | -- | --
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/aws-sdk-ssm-1.148.0/lib/aws-sdk-ssm/client_api.rb:2172:in `<module:ClientApi>'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/aws-sdk-ssm-1.148.0/lib/aws-sdk-ssm/client_api.rb:12:in `<module:SSM>'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/aws-sdk-ssm-1.148.0/lib/aws-sdk-ssm/client_api.rb:10:in `<main>'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/aws-sdk-ssm-1.148.0/lib/aws-sdk-ssm.rb:15:in `require_relative'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/aws-sdk-ssm-1.148.0/lib/aws-sdk-ssm.rb:15:in `<main>'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/runtime.rb:61:in `each'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/runtime.rb:61:in `block in require'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/runtime.rb:50:in `each'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/runtime.rb:50:in `require'
  | 2023-02-14T15:04:39.085-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler.rb:174:in `require'
  | 2023-02-14T15:04:39.085-05:00 | /kith-omas/config/application.rb:7:in `<top (required)>'
  | 2023-02-14T15:04:39.086-05:00 | /kith-omas/Rakefile:4:in `require'
  | 2023-02-14T15:04:39.086-05:00 | /kith-omas/Rakefile:4:in `<top (required)>'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:63:in `load'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:63:in `kernel_load'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:28:in `run'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli.rb:474:in `exec'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli.rb:30:in `dispatch'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/cli.rb:24:in `start'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/exe/bundle:49:in `block in <top (required)>'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/gems/bundler-2.2.22/exe/bundle:37:in `<top (required)>'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/bin/bundle:25:in `load'
  | 2023-02-14T15:04:39.086-05:00 | /usr/local/bundle/bin/bundle:25:in `<main>'

Expected Behavior

The app does not crash on boot (rails s/rails c/…)

Current Behavior

The app randomly crash because of wrong reference to StringShape instead of StructureShape

Reproduction Steps

Unable to reproduce consistently.

Possible Solution

We’ve been trying to pin point the root cause issue but the diff from https://github.com/aws/aws-sdk-ruby/commit/421613e44c0a406d78e36729f40baaf749b75605 is quite tough to navigate.

Additional Information/Context

No response

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

aws-sdk-ssm

Environment details (Version of Ruby, OS environment)

Base image “ruby:3.2.0-slim”

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@mullermp No, but I will open a Bootsnap issue then. For now we disabled Bootsnap in CI as a workaround.