pusher/pusher-http-ruby

Pusher 2.0.3 + Pusher-Fake 3.0.1 + Webmock breaks

catmando opened this issue · 2 comments

This combination breaks with the following error:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: wrong version number

This is in our test environment which is running HTTP (not HTTPS) and uses PusherFake and WebMock. Somewhere along the line, it is trying to use SSL.

I fixed it by downgrading to Pusher 1.4.3 and the problem goes away.

Here is the stacktrace:

"/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:103:in `connect'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:103:in `ssl_connect'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:41:in `initialize'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:26:in `new'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:26:in `create_socket'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:752:in `block in connect'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/timeout-0.3.2/lib/timeout.rb:189:in `block in timeout'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/timeout-0.3.2/lib/timeout.rb:196:in `timeout'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/webmock-3.6.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb:84:in `do_get'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/webmock-3.6.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb:47:in `do_get_block'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pusher-2.0.3/lib/pusher/request.rb:30:in `send_sync'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pusher-2.0.3/lib/pusher/resource.rb:18:in `post'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pusher-2.0.3/lib/pusher/client.rb:190:in `post'",
 "/Users/mitch/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pusher-2.0.3/lib/pusher/client.rb:290:in `trigger'",

I tried to debug this a bit, but I just can't get very far. I am sorry I don't have a more simplified test case, but this is part of an upgrade of a large app, which I am behind on.

Version 2 of the library made a change to use TLS by default. Are you setting use_tls: false when instantiating the object? For example

require 'pusher'

pusher = Pusher::Client.new(
  app_id: 'your-app-id',
  key: 'your-app-key',
  secret: 'your-app-secret',
  cluster: 'your-app-cluster',
  use_tls: false
)

We haven't had a response here so will close this out - if you need further support please get in touch at https://support.pusher.com/hc/en-us/requests/new