Description
Not sure if this an issue with this gem or CloudConvert API. However, the web app I work on as a developer is no longer able to download converted files due to this error (removed the stack trace before the code was ran within the app).
Errno::ECONNREFUSED: Failed to open TCP connection to :443 (Connection refused - connect(2) for nil port 443)
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:878:in `connect'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:852:in `start'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:1398:in `request'
/usr/local/rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.17.1.326/lib/new_relic/agent/instrumentation/net.rb:27:in `block (2 levels) in request_with_newrelic_trace'
/usr/local/rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.17.1.326/lib/new_relic/agent.rb:443:in `disable_all_tracing'
/usr/local/rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.17.1.326/lib/new_relic/agent/instrumentation/net.rb:26:in `block in request_with_newrelic_trace'
/usr/local/rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.17.1.326/lib/new_relic/agent/cross_app_tracing.rb:48:in `tl_trace_http_request'
/usr/local/rvm/gems/ruby-2.3.1/gems/newrelic_rpm-3.17.1.326/lib/new_relic/agent/instrumentation/net.rb:23:in `request_with_newrelic_trace'
/usr/local/rvm/gems/ruby-2.3.1/gems/httparty-0.16.2/lib/httparty/request.rb:143:in `perform'
/usr/local/rvm/gems/ruby-2.3.1/gems/httparty-0.16.2/lib/httparty.rb:563:in `perform_request'
/usr/local/rvm/gems/ruby-2.3.1/gems/httparty-0.16.2/lib/httparty.rb:489:in `get'
/usr/local/rvm/gems/ruby-2.3.1/gems/httmultiparty-0.3.16/lib/httmultiparty.rb:60:in `get'
/usr/local/rvm/gems/ruby-2.3.1/gems/cloudconvert-ruby-0.2.0/lib/cloud_convert/process.rb:70:in `download'
Here is the code I'm using:
def convert_file(inputformat, outputformat, file)
@client = CloudConvert::Client.new(api_key: ENV['CLOUDCONVERT_API_KEY'])
@process = @client.build_process(input_format: inputformat, output_format: outputformat)
@process_response = @process.create
if @process_response[:success]
@conversion_response = @process.convert(
input: "upload",
outputformat: outputformat,
file: file,
download: "false")
if @conversion_response[:success]
@download = @process.download(zoho_download_folder)
else
raise "Conversion failed => Response: #{@conversion_response}"
end
else
raise "Could not obtain a process => Response: #{@process_response}"
end
end
It is used like this:
converted_file = convert_file('xls', 'csv', file)
The file is a 9.5MB xls file downloaded from zoho docs, which doesn't allow CSV downloads, at least at the time this solution was developed.
I have confirmed that this issue started after CloudConvert did a software update about 2 days ago. From the logs I determined this:
Last time the process run was at:
Sun, 17 Jun 2018 12:01:52 +0000
CloudConvert Software updated at
Sun, 17 Jun 2018 15:00:00 +0000 (about 3 hours later)
Next daily run, the app failed to Import at:
Mon, 18 Jun 2018 13:01:19 +0000
I'll also be submitting this to CloudConvert as well.