Reputation: 89
I'm using Nokogiri and I'm receiving this error
Failed to open TCP connection to 127.0.0.1:41585 (Connection refused - connect(2) for "127.0.0.1" port 41585)
on this line of the code
doc = Nokogiri::HTML(open('https://www.instagram.com/p/BfaMpSuDTbn/'))
I should mention that I've run a license sever for registering Rubymine recently and it might have changed the system settings.
Full rails server log:
Errno::ECONNREFUSED (Failed to open TCP connection to 127.0.0.1:41585 (Connection refused - connect(2) for "127.0.0.1" port 41585)):app/controllers/crw_controller.rb:7:in `index'
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_source.erb (19.3ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (13.8ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.4ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (69.4ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (0.7ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.3ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (7.0ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.3ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (55.8ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (16.4ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.6ms)
Rendered /home/arman/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (125.8ms)
Any thoughts?
Upvotes: 3
Views: 9288
Reputation: 89
Actually it was because of my license server I used for registering Rubymine. Reinstalling rails solved the problem.
Upvotes: 1
Reputation: 192
The error code says explicitly that your connection was refused. That means, that the Server didn't allow you to access the ressource.
In your case, the picture is most likely on a private account. You either have to provide credentials of a user with access to the picture or gather data from public sources.
Upvotes: 0