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

WARNING: There appears to be a bug in WebMock's after_request hook and VCR is attempting to work around it. Some VCR features may not work properly. #973

Open
sharon-dang opened this issue Apr 12, 2022 · 0 comments

Comments

@sharon-dang
Copy link

sharon-dang commented Apr 12, 2022

When running Typhoeus http and hydra requests using VCR cassettes, WebMock returns a warning and the rspec fails.

Digging into the stack trace, WebMock is failing to identify instance variables :@__webmock_request_signature and @__typed_vcr_request from the request.

Is this a bug in WebMock? Any clue on how I should resolve this?

Warning:
WARNING: There appears to be a bug in WebMock's after_request hook and VCR is attempting to work around it. Some VCR features may not work properly.

Stack trace (with private files commented out):

      Failure/Error: @response = p_run
      
      ArgumentError:
        wrong number of arguments (given 0, expected 1)
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/library_hooks/webmock.rb:38:in `method'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/library_hooks/webmock.rb:38:in `vcr_request_for'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/library_hooks/webmock.rb:83:in `typed_request_for'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/library_hooks/webmock.rb:151:in `block in <module:WebMock>'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/webmock-3.14.0/lib/webmock/callback_registry.rb:20:in `block in invoke_callbacks'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/webmock-3.14.0/lib/webmock/callback_registry.rb:15:in `each'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/webmock-3.14.0/lib/webmock/callback_registry.rb:15:in `invoke_callbacks'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/webmock-3.14.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb:129:in `block in <class:TyphoeusAdapter>'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb:148:in `block in execute_callbacks'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb:145:in `each'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb:145:in `execute_callbacks'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb:37:in `finish'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/library_hooks/typhoeus.rb:120:in `block in <module:Typhoeus>'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb:21:in `block in run'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb:20:in `each'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb:20:in `run'
      # ./app/models/company_code_file_d:in`fetch'
      # ./app/models/company_code_file_d:in `block in run'
      # ./app/models/company_code_file_d:in `loop'
      # ./app/models/company_code_file_d:in `run'
      # ./app/models/company_code_file_c:in `find'
      # ./app/models/company_code_file_c:in `initialize'
      # ./app/models/company_code_file_b:in `new'
      # ./app/models/company_code_file_b:in `call'
      # ./app/models/company_code_file_b:in `initialize'
      # ./spec/models/company_code_file_a:in `new'
      # ./spec/models/company_code_file_a:in `block (3 levels) in <top (required)>'
      # ./spec/rails_helper.rb:128:in `block (2 levels) in <top (required)>'
      # ./spec/rails_helper.rb:96:in `block (3 levels) in <top (required)>'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr/util/variable_args_block_caller.rb:9:in `call_block'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/vcr-6.1.0/lib/vcr.rb:194:in `use_cassette'
      # ./spec/rails_helper.rb:96:in `block (2 levels) in <top (required)>'
      # /Users/sharondang/.rvm/gems/ruby-3.0.3/gems/webmock-3.14.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'

Versions:
Ruby 3.0.3
Rails 6.0.4.7
Webmock 3.14.0
Typhoeus 1.4.0
VCR 6.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant