tag:blogger.com,1999:blog-6369418367411691447.post2066654449651493132..comments2023-09-23T03:42:22.937-04:00Comments on Mike Subelsky: Fixing "SocketError: getaddrinfo: Name or service not known" with Ruby's resolv-replace.rbUnknownnoreply@blogger.comBlogger10125tag:blogger.com,1999:blog-6369418367411691447.post-60551742325898053562015-01-12T17:38:25.053-05:002015-01-12T17:38:25.053-05:00fwiw I corrected my entry in /etc/hosts and the is...fwiw I corrected my entry in /etc/hosts and the issue went away. I didn't dig any further, so I can't expand on the specifics as to what's going on behind the scenes...Anonymoushttps://www.blogger.com/profile/02739072295673749331noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-1894190188853512602014-11-27T08:14:53.782-05:002014-11-27T08:14:53.782-05:00Thanks, you made my dayThanks, you made my dayAcceptablehttps://www.blogger.com/profile/18270545515593424963noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-78416154711999850422014-10-30T12:59:15.706-04:002014-10-30T12:59:15.706-04:00I had this same issue. Unfortunately for me (or fo...I had this same issue. Unfortunately for me (or fortunately) the IP's on some external API's had changed. As usual, rule out the painfully obvious before looking further. (As you had done)eggmattershttps://www.blogger.com/profile/09773427157780914618noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-60160425757682292282014-09-02T11:56:18.593-04:002014-09-02T11:56:18.593-04:00Brilliant. This saved me a bunch of hassle. Thank ...Brilliant. This saved me a bunch of hassle. Thank you!Terry Shttps://www.blogger.com/profile/17802268376105189025noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-64973039716995982042014-08-18T00:46:48.541-04:002014-08-18T00:46:48.541-04:00I use windows with customized proxy and I get this...I use windows with customized proxy and I get this error: "SocketError Hostname not known: api.stackexchange.com",<br />when I try to "run response = HTTParty.get('https://api.stackexchange.com/2.2/questions?site=stackoverflow')" in the console. Any help would be pleasant)))Anonymoushttps://www.blogger.com/profile/01132566835415691640noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-79715211731060653332014-08-18T00:44:07.227-04:002014-08-18T00:44:07.227-04:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/01132566835415691640noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-68159380543679780932014-08-02T13:29:50.994-04:002014-08-02T13:29:50.994-04:00Thanks for pointing me toward this solution. Turns...Thanks for pointing me toward this solution. Turns out, it was an open with a nil url that happened on heroku, but not locally (?). Once I handled that, all is good.Anonymoushttps://www.blogger.com/profile/14935396518675974039noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-73964561479885126802014-08-01T08:53:58.194-04:002014-08-01T08:53:58.194-04:00I recommend putting that require statement into an...I recommend putting that require statement into an initializer (config/initializers/requires.rb is what I usually do)<br /><br />if that doesn't work, then I would try running dig and whois commands on the server in question, to see if there's something messed-up with the DNS server you are using for lookups.<br /><br />Try using a different DNS server (like Google's public DNS https://developers.google.com/speed/public-dns/)Mike Subelskyhttps://www.blogger.com/profile/03590094055236393140noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-31147219429363707982014-08-01T01:37:30.240-04:002014-08-01T01:37:30.240-04:00Some progress.... this changed my error from "...Some progress.... this changed my error from "SocketError: getaddrinfo: Name or service not known" to "SocketError (Hostname not known: .)"<br /><br />This is the source of the error:<br /><br /> doc = Nokogiri::HTML(open(@full_web_url))<br /><br />I added "require 'resolv-replace'" (without the double quotes) to the top of my action in the controller. Right place?Anonymoushttps://www.blogger.com/profile/14935396518675974039noreply@blogger.comtag:blogger.com,1999:blog-6369418367411691447.post-56970984415768955662014-05-13T02:58:16.346-04:002014-05-13T02:58:16.346-04:00Thank you for posting this! This was incredibly he...Thank you for posting this! This was incredibly helpful. After searching for things like:<br /><br />ruby socketerror<br />and<br />ruby dns lookup issue <br /><br />and many variations, I finally found your blog post and it helped me fix my script. Thank you!Ahttps://www.blogger.com/profile/10709008721699679004noreply@blogger.com