Getting a "Connection Reset by Peer" Error When Hitting Google Contacts API

getting a connection reset by peer error when hitting Google Contacts API

You're requesting an HTTPS resource, so your GET request needs to use SSL encryption.

http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html#method-i-use_ssl-3F

So your last line should look like:

  http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE # You should use VERIFY_PEER in production
request = Net::HTTP::Get.new(uri.request_uri)
res = http.request(request)

Ruby HTTP Library gets Connection Reset with Facebook App

Thanks to Manoj Awasthi for making me realize that there were ssl methods that I couldn't use.

The problem was that I was requiring net/http rather than net/https.

Working snippet:

fb_access_token_url = URI.parse(                                             
'https://graph.facebook.com/oauth/access_token' +
'?grant_type=client_credentials' +
'&client_id=' + FACEBOOK_APP_ID +
'&client_secret=' + FACEBOOK_APP_SECRET)
https = Net::HTTP.new(fb_access_token_url.host, fb_access_token_url.port)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
fb_access_token = https.request_get(fb_access_token_url.path + '?' +
fb_access_token_url.query)

A connection was successfully established with the server, but then an error occurred during the pre-login handshake

Solution

1) Clean your VS.Net Solution

2) Rebuild Project.

3) Reset IIS

4) Run the project again.

Basically that solved my problem, but in my case i was not getting this error and suddenly my local environment starts giving me above error, so may be that trick work for me.

Rails Google Oauth2 Working Locally But Not Remotely

It looks like you use GET requests to /auth/:provider endpoints.

There is security concern with it. You need to change the verb to POST.

See https://stackoverflow.com/a/65785932/2131983 for more details.

Getting 500 Internal Server Error while trying to send an email using Mailgun in Heroku , using Rails 7 and mail_form

Thanks to the help of the comments, I was able to notice by the line in the heroku logs:

2022-04-28T20:35:32.116916+00:00 app[web.1]: [b1e694c5-cea3-427f-bbdd-aa3cc3a92d6b] Errno::ECONNREFUSED (Connection refused - connect(2) for 127.0.0.1:25):

The port being used was 25 instead of 587 meaning that the block

ActionMailer::Base.smtp_settings = {
:port => ENV['MAILGUN_SMTP_PORT'],
:address => ENV['MAILGUN_SMTP_SERVER'],
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:domain => 'https://www.example.com/',
:authentication => :plain,
}

Was being ignored, by instead encompassing those option inside a config.action_mailer.smtp_settings I was able to resolve the issue.

What is my error log telling me?

Yes, it seems that the error is on their part.

Typhoeus -https://github.com/typhoeus/typhoeus is the default user agent.
https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus.rb#L50



Related Topics



Leave a reply



Submit