1

I have a ruby/thor script that uses savon to make a soap request. If I run the script on my desktop with:

thor my_script:my_action

everything works fine. If I run the script with:

bundle exec thor my_script:my_action

I get an error when savon tries to parse the respones. The error is:

Zlib::DataError incorrect header check

I used Gem.loaded_specs.values.map {|x| "#{x.name} #{x.version}"} to see which versions of gems were loaded. with or without the bundle exec the versions are the same. bundle exec does include 2 extra gems bundler and io-console.

If I run the same script on a Server 2012 box I get the Zlib error with or without bundle exec.

How can I get more information on how to make this work?

Desktop Ruby: ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]

Server Ruby: ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]

Stack Trace:

 incorrect header check
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:380:in 'inflate'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:380:in 'block in inflate_adapter'
        C:/tools/ruby23/lib/ruby/2.3.0/net/protocol.rb:411:in 'call_block'
        C:/tools/ruby23/lib/ruby/2.3.0/net/protocol.rb:402:in '<<'
        C:/tools/ruby23/lib/ruby/2.3.0/net/protocol.rb:108:in 'read'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:402:in 'read'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:291:in 'block in read_body_0'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:262:in 'inflater'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:281:in 'read_body_0'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:202:in 'read_body'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:227:in 'body'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http/response.rb:164:in 'reading_body'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http.rb:1445:in 'transport_request'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http.rb:1407:in 'request'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:70:in 'perform'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:47:in 'block in request'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:87:in 'block in do_request'
        C:/tools/ruby23/lib/ruby/2.3.0/net/http.rb:853:in 'start'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:85:in 'do_request'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:38:in 'request'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi.rb:161:in 'request'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi.rb:133:in 'post'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in 'block in call_with_logging'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/request_logger.rb:12:in 'log'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in 'call_with_logging'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:54:in 'call'
        C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/client.rb:36:in 'call'
        D:/integrator_promo/lib/soap_order_status.rb:47:in 'query_all_since_last_update'
        D:/integrator_promo/lib/update_runner.rb:61:in 'block (2 levels) in process'
  • Pleae add the stacktrace too – kiddorails Aug 18 '17 at 20:28
  • It appears there could be a bug in the http lib. See: https://bugs.ruby-lang.org/issues/11268 . I looked at 2.3.4 and it's not fixed even there. You can find the patch file here: https://bugs.ruby-lang.org/attachments/5489/net_http.patch . You only need to change one line in `lib/net/http/generic_request.rb` and one line in `response.rb`. – Casper Aug 18 '17 at 20:55
  • Alternative fix in the client code instead: https://stackoverflow.com/questions/37926803/why-am-i-getting-zlibdataerror – Casper Aug 18 '17 at 20:58

0 Answers0