slack-ruby-client
slack-ruby-client copied to clipboard
Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
I am initializing my client as:
client = Slack::Web::Client.new(ca_path: "/home/deploy", ca_file: "cacert.pem")
where cacert.pem
was downloaded from Mozilla here https://curl.se/docs/caextract.html
but I am still getting error:
client.chat_postMessage(channel: @channel, text: "TEST", as_user: true)
Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
Any idea? Kindly notice that certificate worked well with the slack-notifier
gem which calls hooks.slack.com
I would first check whether https://github.com/slack-ruby/slack-ruby-client/blob/master/lib/slack/web/faraday/connection.rb#L17 is getting these options, just to be sure. Then reproduce just with Faraday directly.
@dblock I checked that and I can see the params I passed on this line https://github.com/slack-ruby/slack-ruby-client/blob/master/lib/slack/web/faraday/connection.rb#LL18C1-L18C1
still get same error
Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify faile
Reproduce with Faraday alone. I suspect it's the same problem, which means it's not an issue with the client itself (I don't know what the problem is though).
I had the same error. As a fix, I passed params ca_path
and ca_file
directly: Slack::Web::Client.new ca_path: nil, ca_file: nil
.
It should be save since it uses default cert store if the params are empty.
https://github.com/jruby/jruby-openssl/blob/968bff99a394cb53ab8388316c03c41f4e231015/lib/openssl/ssl.rb#L138
@gabifija In slack-ruby-client 2.0 these were set to nil
, see https://github.com/slack-ruby/slack-ruby-client/blob/master/UPGRADING.md#upgrading-to--200. Your issue is different, the OP is setting these to specific values.