rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.69k stars 120 forks source link

500 error, possibly related to web sockets #356

Open andrewkatz opened 1 year ago

andrewkatz commented 1 year ago

I'm seeing an error that pops up sometimes. Not a consistent issue, but enough to fail our builds every few days. We're using Cuprite for our Rails system tests.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
#<Thread:0x00007fb8b0052858 /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/ferrum-0.13/lib/ferrum/browser/web_socket.rb:30 run> terminated with exception (report_on_exception is true):
/home/runner/work/platform/platform/spec/support/capybara.rb:19:in `puts': undefined method `[]' for nil:NilClass (NoMethodError)

      Kernel.puts "#{log_body['params']['entry']['url']} - #{log_body['params']['entry']['text']}"
                                                ^^^^^^^
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/ferrum-0.13/lib/ferrum/browser/web_socket.rb:64:in `on_message'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/event_emitter.rb:39:in `block in emit'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/event_emitter.rb:38:in `each'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/event_emitter.rb:38:in `emit'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/hybi.rb:408:in `emit_message'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/hybi.rb:390:in `emit_frame'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/hybi.rb:118:in `parse'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/websocket-driver-0.7.5/lib/websocket/driver/client.rb:63:in `parse'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/ferrum-0.13/lib/ferrum/browser/web_socket.rb:39:in `block (2 levels) in initialize'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/ferrum-0.13/lib/ferrum/browser/web_socket.rb:35:in `loop'
    from /home/runner/work/platform/platform/vendor/bundle/ruby/3.1.0/gems/ferrum-0.13/lib/ferrum/browser/web_socket.rb:35:in `block in initialize'

After that error, the next request attempt times out and we'll see:

No route matches [GET] "/features"
Ferrum::TimeoutError
sandstrom commented 8 months ago

I'm doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it's quite old I just wanted to ask if this is still relevant? If it isn't, maybe we can close this issue?

By closing some old issues we reduce the list of open issues to a more manageable set.

route commented 8 months ago

Thanks @sandstrom I appreciate it!