I have some ruby test code that hits an API endpoint and sends it JSON.
RestClient.post(url, json, :content_type => :json, :accept => :json) { |response, request, result|
@last_response = response
}
It works ittermittently sometimes giving this error.
Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect
What can I get more information about what is going on?
By setting RESTCLIENT_LOG=stdout
environment variable you will see RestClient debug data in the terminal. Or you can replace stdout with a file path to write it out to a log file.
The reason may be an invalid SSL cert or just a flaky API endpoint that sometimes disconnects before returning a response.
It can be challenging to troubleshoot this sort of network error. If it keeps up, you could try capturing the network traffic with Wireshark or tcpdump, which might give some insight into what's happening.
In general ECONNRESET
usually means that the remote server closed the connection while you the client still had data queued for sending to it.