Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

SSLError #4

Open
dave315 opened this issue Jan 3, 2018 · 14 comments
Open

SSLError #4

dave315 opened this issue Jan 3, 2018 · 14 comments

Comments

@dave315
Copy link

dave315 commented Jan 3, 2018

Hey! First of all thanks for making this Gem.

I am getting a Faraday::SSLError... have you encountered that before? Everything else in my app is working fine but as soon as I start to use this client I encounter Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed

Have you seen this before?

@craysiii
Copy link
Owner

craysiii commented Jan 3, 2018

Hey @dave315 - thanks for that!

Typically when I've encountered this error it has been because I was developing on Windows and didn't have the proper certificate file and environment variable set. Are you on Windows?

If that doesn't work please report back so I can further investigate the issue. SSL errors are no fun.

@dave315
Copy link
Author

dave315 commented Jan 4, 2018

@craysiii Yeah, I realized after I posted this that it is probably just something wrong with my machine. I'm using OSX and still haven't quite been able to figure out why this is happening yet. It must have something to do with my certs but I'm pretty bad at this stuff.

Not sure if it is worth investigating at all or if you could just close out the issue since I'm assuming this is an issue specific to me.

@craysiii
Copy link
Owner

craysiii commented Jan 4, 2018

Hey @dave315 - would love to help you on the issue.

Two questions:

  • what version of macOS are you running?
  • which ruby are you using / how did you install it?

@andrewroth
Copy link

I'm also getting this error. I use RVM and just updated to the latest, updated certs, and made sure that puts "SSL_CERT_FILE: %s" % OpenSSL::X509::DEFAULT_CERT_FILE gives a path that does exist with the certs. All looks right...

@andrewroth
Copy link

I'm running OS X El Capitan

andrewroth added a commit to andrewroth/binance that referenced this issue Jan 12, 2018
I know that is not good, but until
craysiii#4 is fixed
@craysiii
Copy link
Owner

Hey @andrewroth - Thanks for the info.

This is definitely interesting and a bit puzzling. I was able to use the gem just fine on a clean install of High Sierra, with RVM installed through homebrew.

Does this happen on all endpoints, or only certain ones? I will investigate further tonight after work.

@juancgarza
Copy link

I've also encountered this error but have recently changed laptops.
Have not tried it with the new one, still using OSx though.

@craysiii
Copy link
Owner

Hey @dave315 @andrewroth @juancgarza - Check out this github issue, which may have possible solutions for you. Seems like some people have had success setting the SSL_CERT_FILE environment variable and pointing it to an updated cacerts.pem like one would for the Windows fix. There are other solutions there as well, like upgrading to MRI 2.3+.

Hope this helps. Report back regardless please!

@andrewroth
Copy link

No go :(

2.3.1 :002 > ENV['SSL_CERT_FILE']
 => "/usr/local/etc/openssl@1.1/certs/cacert.pem" 
2.3.1 :003 > File.exists?(ENV['SSL_CERT_FILE'])
 => true 
2.3.1 :004 > $binance.ping
Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:852:in `start'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:1398:in `request'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:1156:in `get'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/adapter/net_http.rb:78:in `perform_request'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/adapter/net_http.rb:38:in `block in call'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/adapter/net_http.rb:85:in `with_net_http_connection'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/adapter/net_http.rb:33:in `call'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:31:in `call'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday_middleware-0.12.2/lib/faraday_middleware/request/encode_json.rb:24:in `call'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/rack_builder.rb:141:in `build_response'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/connection.rb:386:in `run_request'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/faraday-0.12.2/lib/faraday/connection.rb:149:in `get'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1/gems/binance-0.4.0/lib/binance/client/rest.rb:61:in `request'
... 3 levels...
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
	from /Users/Andrew/Development/arbitrator/bin/rails:9:in `<top (required)>'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /Users/Andrew/.rvm/gems/ruby-2.3.1@global/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/Andrew/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'

@andrewroth
Copy link

another crypto library is having the same issue for people: ccxt/ccxt#452

@craysiii
Copy link
Owner

That is really weird to say the least..

It would be easy to blame it on Binance, but I don't know if they really are the root cause, as I can ping and any other method just fine. How did you update your cacert.pem? What source did it come from?

@andrewroth
Copy link

I got it from the link in the stackoverflow for the windows fix. curl.haxx.se.. But I just noticed it's an empty file, so let me re-download that and try again

@andrewroth
Copy link

Yes, it works now! Thanks!

@craysiii
Copy link
Owner

Awesome! Happy coding :)

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

No branches or pull requests

4 participants