title: GraphQL API Lost Connection
body: <p>I have a machine with a <a href="https://github.com/input-output-hk/cardano-graphql" rel="nofollow noreferrer">docker-graphql/server</a> that runs a Graphql API.</p>
  <p>I was normally connecting to that machine with HTTP requests trough:</p>
  <pre class="lang-rb prettyprint-override"><code>uri = URI.parse(&quot;http://#{ENV['IP_CARDANO_GRAPHQL_API_SERVER']}:3100/&quot;)
  request = Net::HTTP::Post.new(uri)
  request.content_type = &quot;application/json&quot;
  request[&quot;Accept&quot;] = &quot;application/json&quot;
  request[&quot;Connection&quot;] = &quot;keep-alive&quot;
  request[&quot;Dnt&quot;] = &quot;1&quot;
  request[&quot;Origin&quot;] = &quot;http://#{ENV['IP_CARDANO_GRAPHQL_API_SERVER']}:3100&quot;
  
  obj = {&quot;query&quot;: query}
  
  request.body = JSON.dump(obj)
  
  req_options = {
      use_ssl: uri.scheme == &quot;https&quot;,
      read_timeout: 5
  }
  
  response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
      http.request(request)
  end
  # puts response.code
  return JSON.parse(response.body)['data']
  </code></pre>
  <p>but suddenly it stopped working end up with this problem:</p>
  <pre><code>Caused by:
  Net::ReadTimeout: Net::ReadTimeout with #&lt;TCPSocket:(closed)&gt;
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/protocol.rb:217:in `rbuf_fill'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/protocol.rb:191:in `readuntil'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/protocol.rb:201:in `readline'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http/response.rb:40:in `read_status_line'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http/response.rb:29:in `read_new'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:1509:in `block in transport_request'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:1506:in `catch'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:1506:in `transport_request'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:1479:in `request'
  /Users/sergio/Documents/github/learn/front-end/delegations-explorer/Rakefile:218:in `block in query_graphql'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:920:in `start'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/net/http.rb:605:in `start'
  /Users/sergio/Documents/github/learn/front-end/delegations-explorer/Rakefile:217:in `query_graphql'
  /Users/sergio/Documents/github/learn/front-end/delegations-explorer/Rakefile:130:in `block (2 levels) in &lt;top (required)&gt;'
  /Users/sergio/Documents/github/learn/front-end/delegations-explorer/Rakefile:116:in `each'
  /Users/sergio/Documents/github/learn/front-end/delegations-explorer/Rakefile:116:in `block in &lt;top (required)&gt;'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
  /Users/sergio/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:83:in `block in run'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
  /Users/sergio/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/exe/rake:27:in `&lt;top (required)&gt;'
  /Users/sergio/.rvm/gems/ruby-2.6.3/bin/rake:23:in `load'
  /Users/sergio/.rvm/gems/ruby-2.6.3/bin/rake:23:in `&lt;main&gt;'
  /Users/sergio/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
  /Users/sergio/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `&lt;main&gt;'
  Tasks: TOP =&gt; getRewards
  </code></pre>
  <p>The playgroung works just fine from the local machine where the ruby script is running from.</p>