Note that there are some explanatory texts on larger screens.

plurals
  1. POSSL_connect error when accessing Shopify API with rubygem
    primarykey
    data
    text
    <p>I'm having trouble accessing the Shopify API using the shopify_api gem.</p> <p>Here's what happens:</p> <pre><code>&gt;&gt; require "shopify_api" #=&gt; false &gt;&gt; ShopifyAPI::Base.site = "https://username:secret@mysite.myshopify.com/admin" =&gt; "https://username:secret@mysite.myshopify.com/admin" &gt;&gt; products = ShopifyAPI::Product.find(:all) Errno::ECONNRESET: Connection reset by peer - SSL_connect from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1284:in `request' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1026:in `get' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:113:in `block in request' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:110:in `request' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/shopify_api-3.0.1/lib/active_resource/connection_ext.rb:13:in `request_with_detailed_log_subscriber' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:80:in `block in get' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:218:in `with_auth' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:80:in `get' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/base.rb:901:in `find_every' from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/base.rb:813:in `find' from (irb):21 from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `&lt;main&gt;' </code></pre> <p>Thinking it was a problem with ruby's openssl bindings, I installed openssl with RVM and reinstalled ruby:</p> <pre><code>rvm pkg install openssl rvm reinstall 1.9.3-p194 --with-openssl-dir=~/.rvm/usr </code></pre> <p>But that didn't help.</p> <p>So I tried connecting with plain ol' <code>NET::HTTPS</code> and was able to connect to another site, but not shopify.</p> <pre><code>&gt;&gt; require "net/https" #=&gt; false &gt;&gt; require "uri" #=&gt; false &gt;&gt; uri = URI.parse("https://google.com/") #=&gt; #&lt;URI::HTTPS:0x007fa27bb243f8 URL:https://google.com/&gt; &gt;&gt; http = Net::HTTP.new(uri.host, uri.port) #=&gt; #&lt;Net::HTTP google.com:443 open=false&gt; &gt;&gt; http.use_ssl = true #=&gt; true &gt;&gt; http.verify_mode = OpenSSL::SSL::VERIFY_NONE #=&gt; 0 &gt;&gt; http.start { |agent| p agent.get(uri.path).read_body } "&lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"&gt;\n&lt;TITLE&gt;301 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;\n&lt;H1&gt;301 Moved&lt;/H1&gt;\nThe document has moved\n&lt;A HREF=\"https://www.google.com/\"&gt;here&lt;/A&gt;.\r\n&lt;/BODY&gt;&lt;/HTML&gt;\r\n" =&gt; "&lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"&gt;\n&lt;TITLE&gt;301 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;\n&lt;H1&gt;301 Moved&lt;/H1&gt;\nThe document has moved\n&lt;A HREF=\"https://www.google.com/\"&gt;here&lt;/A&gt;.\r\n&lt;/BODY&gt;&lt;/HTML&gt;\r\n" &gt;&gt; uri = URI.parse("https://mysite.myshopify.com/admin/") =&gt; #&lt;URI::HTTPS:0x007fa27d1f5e38 URL:https://mysite.myshopify.com/admin/&gt; &gt;&gt; http = Net::HTTP.new(uri.host, uri.port) #=&gt; #&lt;Net::HTTP mysite.myshopify.com:443 open=false&gt; &gt;&gt; http.use_ssl = true #=&gt; true &gt;&gt; http.verify_mode = OpenSSL::SSL::VERIFY_NONE #=&gt; 0 &gt;&gt; http.start { |agent| p agent.get(uri.path).read_body } Errno::ECONNRESET: Connection reset by peer - SSL_connect from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start' from (irb):18 from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `&lt;main&gt;' </code></pre> <p>So that rules out my ruby/openssl setup. Any ideas what's causing the SSL_connect error?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload