当前位置: 首页 > 知识库问答 >
问题:

使用rubygem访问Shopify API时SSL_connect错误

尉迟默
2023-03-14

使用Shopify_apigem访问Shopify API时遇到问题。

以下是发生的情况:

>> require "shopify_api" #=> false
>> ShopifyAPI::Base.site = "https://username:secret@mysite.myshopify.com/admin"
=> "https://username:secret@mysite.myshopify.com/admin"
>> 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 `<main>'

我认为这是红宝石的开放绑定的问题,我用RVM安装了开放sl并重新安装了红宝石:

rvm pkg install openssl
rvm reinstall 1.9.3-p194 --with-openssl-dir=~/.rvm/usr

但这并没有帮助。

所以我试着用plain ol' NET::HTTPS连接,并能连接到另一个网站,但不能shopify。

>> require "net/https" #=> false
>> require "uri" #=> false
>> uri = URI.parse("https://google.com/") #=> #<URI::HTTPS:0x007fa27bb243f8 URL:https://google.com/>
>> http = Net::HTTP.new(uri.host, uri.port) #=> #<Net::HTTP google.com:443 open=false>
>> http.use_ssl = true #=> true
>> http.verify_mode = OpenSSL::SSL::VERIFY_NONE #=> 0
>> http.start { |agent| p agent.get(uri.path).read_body }
"<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>301 Moved</TITLE></HEAD><BODY>\n<H1>301 Moved</H1>\nThe document has moved\n<A HREF=\"https://www.google.com/\">here</A>.\r\n</BODY></HTML>\r\n"
=> "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>301 Moved</TITLE></HEAD><BODY>\n<H1>301 Moved</H1>\nThe document has moved\n<A HREF=\"https://www.google.com/\">here</A>.\r\n</BODY></HTML>\r\n"
>> uri = URI.parse("https://mysite.myshopify.com/admin/")
=> #<URI::HTTPS:0x007fa27d1f5e38 URL:https://mysite.myshopify.com/admin/>
>> http = Net::HTTP.new(uri.host, uri.port) #=> #<Net::HTTP mysite.myshopify.com:443 open=false>
>> http.use_ssl = true #=> true
>> http.verify_mode = OpenSSL::SSL::VERIFY_NONE #=> 0
>> 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 `<main>'

所以这排除了我的红宝石/开放设置。任何想法是什么导致了SSL_connect错误?

共有1个答案

司空奕
2023-03-14

最有可能的是,您的客户端正在尝试使用TLS 1.2进行连接,这是HTTPS中使用的最新SSL/TLS协议之一。我们的负载平衡硬件在TLS 1.2中存在已知问题,尽管直到我自己偶然发现这个错误,我们才意识到这一点。

我已经让运营团队的其他人意识到了这一点,我希望我们会尽快解决这个问题。在那之前,你可以使用

http。ssl_version=:TLSv1

强制< code>Ruby改用< code>TLS 1.0。

 类似资料:
  • 我无法在我的MacBook Pro(Catalina OS)中安装家酿。我已经尝试在home-brew网站中使用current命令 /bin/bash-c“$(curl-fssl https://raw.githubusercontent.com/homebrew/install/head/install.sh)”

  • 问题: 能够使用AWS CLI和Boto3成功下载文件。但是,在使用Hadoop/Spark的S3A连接器时,收到以下错误: 配置:在本地计算机上运行此配置 > Spark版本2.4.4 Hadoop版本2.7 贾尔斯补充道: > Hadoop-aws-2.7.3.jar aws-java-sdk-1.7.4.jar Hadoop配置: 读取文件的代码:

  • 问题内容: 我有一个应该将文件发送到Web服务的程序,该程序需要SSL连接。我运行程序如下: 这很好,但是当我将第一行更改为 我收到以下错误: 因此,似乎该问题与我正在使用的JRE有关,但似乎没有意义的是非IBM JRE可以正常工作,而IBM JRE则不能。有什么想法或建议吗? 问题答案: 如果您的非IBM jre是sun,那么它已经附带了SSL类实现。 看来IBM jre根本不包含SSL实现类。

  • Mailgun rubygem 是 Mailgun 服务的 Ruby 开发包,功能包括: Mailing Lists Mailing List Members Mailboxes Routes Log Stats Messages Bounces Unsubscribes Complaints

  • 我正在尝试使用播放器模块访问android摄像头,但我遇到了以下错误,我不知道如何解决它。 这是我的密码。 我的建筑工人。规格: 有办法解决吗?

  • 我得到: 错误:(37,30)Java:无法访问未找到java.util.function.function的java.util.function.function类文件 指向“等待”