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
Traceback (most recent call last):
14: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/capybara-3.37.1/lib/capybara/selenium/driver.rb:516:in `block in setup_exit_handler'
13: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/capybara-3.37.1/lib/capybara/selenium/driver.rb:293:in `quit'
12: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/common/driver.rb:181:in `quit'
11: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/remote/bridge.rb:186:in `quit'
10: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/remote/bridge.rb:625:in `execute'
9: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
8: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/remote/http/default.rb:77:in `request'
7: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.4.0/lib/selenium/webdriver/remote/http/default.rb:118:in `response_for'
6: from /home/circleci/search-gov/vendor/bundle/ruby/2.7.0/gems/webmock-3.18.0/lib/webmock/http_lib_adapters/net_http.rb:84:in `request'
5: from /usr/local/lib/ruby/2.7.0/net/http.rb:1492:in `request'
4: from /usr/local/lib/ruby/2.7.0/net/http.rb:1519:in `transport_request'
3: from /usr/local/lib/ruby/2.7.0/net/http.rb:1519:in `catch'
2: from /usr/local/lib/ruby/2.7.0/net/http.rb:1521:in `block in transport_request'
1: from /usr/local/lib/ruby/2.7.0/net/http/generic_request.rb:129:in `exec'
/usr/local/lib/ruby/2.7.0/net/http/generic_request.rb:335:in `write_header': undefined method `write' for #<StubSocket:0x0000564298bf50f0 @closed=true> (NoMethodError)
Are you able to provide an example code to reproduce it or show more stacktrace to understand where this write is called?
Hello,
I just put webmock in the Gemfile of my Rails's app, then i put require "webmock/rspec" in spec_helper.rb and i have rspec file like this:
require"rails_helper"RSpec.feature"LoginMethods",type: :feature,js: truedobeforedo@google_user=create(:user,login_method: "external",provider: "google_oauth2")OmniAuth.config.test_mode=trueendscenario"reject internal login"dovisitnew_user_session_pathbyebugfill_in"Email",with: @google_user.emailfill_in"Password",with: @google_user.passwordclick_button"Sign in"expect(page).tohave_content("This account is for login using Google account.")endend
As you can see i put byebug inside scenario and the error is thrown when i type fill_in "Email", with: @google_user.email within byebug's prompt.
Just FYI, the error is gone when i tried with 3.18.1.
Sorry for the trouble everyone. I'll investigate further and try to figure out what went wrong here. The core problem seems to be that StubSocket isn't a very convincing stub of a socket.
I have the same issue but with the slightly different case. I'm trying to use vite-ruby gem in my Rails app that has a webvalve dependency. Webvalve uses webmock internally on dev env which breaks ruby-vite setup with:
Puma caught this error: undefined method `write' for an instance of StubSocket (NoMethodError)
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/net/http/generic_request.rb:410:in `write_header'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/net/http/generic_request.rb:206:in `exec'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-proxy-0.7.7/lib/net_http_hacked.rb:51:in `begin_request_hacked'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-proxy-0.7.7/lib/rack/http_streaming_response.rb:52:in `response'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-proxy-0.7.7/lib/rack/http_streaming_response.rb:24:in `code'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-proxy-0.7.7/lib/rack/proxy.rb:156:in `perform_request'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/vite_ruby-3.9.1/lib/vite_ruby/dev_server_proxy.rb:20:in `perform_request'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-proxy-0.7.7/lib/rack/proxy.rb:87:in `call'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-7.0.8/lib/rails/engine.rb:530:in `call'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
/Users/mbajur/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
No matter if I'm on webmock 3.17.1 or 3.18.1 or edge. There are three gems involved in this so I'm not sure if webmock is the one to blame but i will be super grateful for any tips or monkeypatches or just pointing me into the right direction 🙏
Activity
bblimke commentedon Aug 18, 2022
@zsan thank you for reporting.
Are you able to provide an example code to reproduce it or show more stacktrace to understand where this
write
is called?Would you mind trying the following two commits and see if it works on any of them?
gem 'webmock', github: 'bblimke/webmock', branch: '102dd56'
gem 'webmock', github: 'bblimke/webmock', branch: '2c10bd9'
@rzane any thoughts?
ingemar commentedon Aug 18, 2022
I can confirm that 2c10bd9 is the offending commit.
Installing 102dd56 and our test suite runs just fine!
bblimke commentedon Aug 18, 2022
I have released 3.18.1 with reverted 2c10bd9
It would be good to get a test or sample code to reproduce the issue or at least a stacktrace from the error.
MothOnMars commentedon Aug 18, 2022
@bblimke , I have a test branch that started failing with 3.18.0:
https://github.com/MothOnMars/search-gov/tree/webmock
https://app.circleci.com/pipelines/github/MothOnMars/search-gov/2333/workflows/e2a6416b-7564-4a5b-8ed0-15bb64382a8b
Sample stacktrace:
zsan commentedon Aug 18, 2022
Hello,
I just put
webmock
in theGemfile
of my Rails's app, then i putrequire "webmock/rspec"
inspec_helper.rb
and i have rspec file like this:As you can see i put
byebug
inside scenario and the error is thrown when i typefill_in "Email", with: @google_user.email
within byebug's prompt.Just FYI, the error is gone when i tried with
3.18.1
.ingemar commentedon Aug 19, 2022
Version
3.18.1
works fine for us! Thank you for your quick work!rzane commentedon Aug 23, 2022
Sorry for the trouble everyone. I'll investigate further and try to figure out what went wrong here. The core problem seems to be that StubSocket isn't a very convincing stub of a socket.
mbajur commentedon Jan 26, 2025
I have the same issue but with the slightly different case. I'm trying to use vite-ruby gem in my Rails app that has a webvalve dependency. Webvalve uses webmock internally on dev env which breaks ruby-vite setup with:
No matter if I'm on webmock 3.17.1 or 3.18.1 or edge. There are three gems involved in this so I'm not sure if webmock is the one to blame but i will be super grateful for any tips or monkeypatches or just pointing me into the right direction 🙏