active_shipping icon indicating copy to clipboard operation
active_shipping copied to clipboard

Remote server reset the connection

Open joshkinabrew opened this issue 8 years ago • 0 comments

I'm running in to an issue when calculating shipping for packages. See below for the setup. The shipping_service object is just ActiveShipping::USPS.new(login: 'my-login-key')

irb> shipping_packages
[
    [0] #<ActiveShipping::Package:0x00000009b549c0 @options={}, @dimensions=[#<Quantified::Length: 1.4 centimetres>, #<Quantified::Length: 14.0 centimetres>, #<Quantified::Length: 21.5 centimetres>], @weight_unit_system=:metric, @dimensions_unit_system=:metric, @weight=#<Quantified::Mass: 260.0 grams>, @value=nil, @currency=nil, @cylinder=false, @gift=false, @oversized=false, @unpackaged=false, @inches=[#<BigDecimal:740a248,'0.5511811023 6220472E0',18(45)>, #<BigDecimal:7409a78,'0.5511811023 6220472E1',27(36)>, #<BigDecimal:74092d0,'0.8464566929 1338582E1',27(45)>]>,
    [1] #<ActiveShipping::Package:0x00000009ad4e00 @options={}, @dimensions=[#<Quantified::Length: 0.8 centimetres>, #<Quantified::Length: 20.3 centimetres>, #<Quantified::Length: 25.4 centimetres>], @weight_unit_system=:metric, @dimensions_unit_system=:metric, @weight=#<Quantified::Mass: 495.0 grams>, @value=nil, @currency=nil, @cylinder=false, @gift=false, @oversized=false, @unpackaged=false, @inches=[#<BigDecimal:73cb840,'0.3149606299 2125984E0',18(36)>, #<BigDecimal:73cb228,'0.7992125984 25196844E1',27(45)>, #<BigDecimal:73caeb8,'0.9999999999 99999992E1',27(45)>]>
]
irb> destination_address.decorate.shipping_address
{
         :country => "US",
     :postal_code => "93637",
        :province => "California",
            :city => "Madera",
            :name => nil,
        :address1 => "",
        :address2 => nil,
        :address3 => nil,
           :phone => nil,
             :fax => nil,
    :address_type => nil,
    :company_name => nil
}
irb> origin
{
         :country => "US",
     :postal_code => "80550",
        :province => "CO",
            :city => "Windsor",
            :name => nil,
        :address1 => nil,
        :address2 => nil,
        :address3 => nil,
           :phone => nil,
             :fax => nil,
    :address_type => nil,
    :company_name => nil
}
irb> shipping_service.find_rates(origin, destination_address.decorate.shipping_address, shipping_packages.flatten)
ActiveUtils::ConnectionError: The remote server reset the connection
from /home/ubuntu/.rvm/gems/ruby-2.3.1@store/gems/active_utils-3.2.2/lib/active_utils/network_connection_retries.rb:31:in `rescue in block in retry_exceptions'
irb>
irb>

This seems to work when I just do 1 package (doesn't matter which one) but it never has worked with 2 packages.

Any thoughts?

joshkinabrew avatar Nov 16 '16 23:11 joshkinabrew