You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stub_responses raises ArgumentError with mocha loaded since aws-sdk-core 3.270.0 #3503
Since aws-sdk-core 3.270.0, Client#stub_responses raises ArgumentError whenever mocha is loaded.
3.270.0 changed Seahorse::Client::Configuration so it no longer generates a real Struct, and options are now answered through method_missing (seahorse/client/configuration.rb). Mocha mixes Mocha::ObjectMethods#stubs(stubbed_methods_vs_return_values) into every object, so @config.stubs in Aws::ClientStubs#apply_stubs (client_stubs.rb:238) resolves to mocha's real method instead of reaching method_missing. It is called with no arguments and raises.
Any Rails/Minitest suite that uses mocha and stub_responses: true breaks on upgrade. 3.268.0 works.
Expected Behavior
stub_responses stores the stub regardless of methods other libraries define on Object, as it does on 3.268.0.
Current Behavior
ArgumentError: wrong number of arguments (given 0, expected 1)
mocha-3.1.0/lib/mocha/object_methods.rb:134:in 'Mocha::ObjectMethods#stubs'
aws-sdk-core-3.271.0/lib/aws-sdk-core/client_stubs.rb:238:in 'block in Aws::ClientStubs#apply_stubs'
aws-sdk-core-3.271.0/lib/aws-sdk-core/client_stubs.rb:237:in 'Thread::Mutex#synchronize'
aws-sdk-core-3.271.0/lib/aws-sdk-core/client_stubs.rb:237:in 'Aws::ClientStubs#apply_stubs'
aws-sdk-core-3.271.0/lib/aws-sdk-core/client_stubs.rb:163:in 'Aws::ClientStubs#stub_responses'
Reproduction Steps
gem"aws-sdk-core","3.271.0"# same on 3.270.0require"aws-sdk-s3"require"mocha/object_methods"Object.include(Mocha::ObjectMethods)# what mocha/minitest doesclient=Aws::S3::Client.new(stub_responses: true,region: "us-east-1")client.stub_responses(:list_objects_v2,{contents: []})# => ArgumentError: wrong number of arguments (given 0, expected 1)
Possible Solution
Read config values in ClientStubs via @config[:stubs] / @config[:stubs_mutex] (or otherwise avoid dispatching option names that collide with methods defined on Object), or define real reader methods on the configuration object again.
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.
Activity
dscpinheiro commentedon Nov 20, 2026
This seems to be the same issue as #3501 (we already have a PR to address it - #3502)
jterapin commentedon Nov 20, 2026
Since this is a duplicate, I will be closing this issue so please track the latest updates in this issue #3501
stubsconfig option #3501github-actions commentedon Nov 20, 2026
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.