Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-sdk-s3 version 1.165.0 invalid configuration option #3113

Closed
1 task done
kddnewton opened this issue Sep 24, 2024 · 5 comments
Closed
1 task done

aws-sdk-s3 version 1.165.0 invalid configuration option #3113

kddnewton opened this issue Sep 24, 2024 · 5 comments
Assignees
Labels
bug This issue is a bug. potential-regression Marking this issue as a potential regression to be checked by team member

Comments

@kddnewton
Copy link
Contributor

Describe the bug

Stubbing s3 and then initializing a cloudformation client fails.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I expect this to succeed the same as previous versions.

Current Behavior

It gives an argument error.

Reproduction Steps

Here is a test that fails on the latest s3 client:

# frozen_string_literal: true

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "aws-sdk-cloudformation"
  # gem "aws-sdk-s3", "1.164.0"
  gem "aws-sdk-s3", "1.165.0"
  gem "base64"
  gem "minitest", require: "minitest/autorun"
  gem "nokogiri"
end

class Test < Minitest::Test
  def test_behavior
    Aws.config[:s3] = {
      stub_responses: {
        get_object: true,
        put_object: true
      }
    }

    Aws::CloudFormation::Client.new(
      region: "us-east-1",
      credentials: Aws::Credentials.new("foo", "bar")
    )
  end
end

If you switch the comments to use 1.164.0, it will work.

Possible Solution

No response

Additional Information/Context

No response

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

aws-sdk-s3 and aws-sdk-cloudformation

Environment details (Version of Ruby, OS environment)

3.4.0-dev, macOS

@kddnewton kddnewton added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 24, 2024
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Sep 24, 2024
@alextwoods alextwoods self-assigned this Sep 24, 2024
@alextwoods alextwoods added the investigating Issue is being investigated label Sep 24, 2024
@alextwoods
Copy link
Contributor

Thanks for reporting this and for the great reproduction. It looks like the issue is caused by the recent autoload PR (#3105) which adds autoload for service clients. Service client's on require add their service identifier to the global config plugin's list of identifiers which it uses to filter out config (example from s3: Aws::Plugins::GlobalConfiguration.add_identifier(:s3)).

I'll get a fix out today, but in the mean time, you can get around this by using S3 Client (eg just a Aws::S3.const_get(:Client)) before creating the cloudwatch client:

Aws.config[:s3] = {
  stub_responses: {
    get_object: true,
    put_object: true
  }
}

Aws::S3.const_get(:Client) # this triggers the autoload and ensures s3's service id is added to the global config plugin.

Aws::CloudFormation::Client.new(
  region: "us-east-1",
  credentials: Aws::Credentials.new("foo", "bar")
)

@kddnewton
Copy link
Contributor Author

Perfect, thanks @alextwoods!

@kddnewton
Copy link
Contributor Author

(Confirmed, that does indeed fix my problem.)

@alextwoods
Copy link
Contributor

We've released the fix - [email protected] and later should no longer have this issue.

Copy link

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.

@alextwoods alextwoods removed investigating Issue is being investigated needs-triage This issue or PR still needs to be triaged. labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. potential-regression Marking this issue as a potential regression to be checked by team member
Projects
None yet
Development

No branches or pull requests

2 participants