Error: ConnectionError
: Connection Reset by Peer
Issue
While running the fivetran debug
command, the following error appears:
requests.exceptions.ConnectionError: ('Connection aborted.',
ConnectionResetError(104, 'Connection reset by peer'))
Environment
Fivetran Connector SDK
Resolution
To resolve this issue, use the pycurl
library for API calls instead of the requests
library. You can do that by following these steps:
Install the
pycurl
library:pip install pycurl
In your Python code, replace API calls that use
requests
with ones that usepycurl
.Reset and test you connector again:
fivetran reset fivetran debug
By switching to pycurl
, you gain more direct control over connection parameters, which helps to avoid the connection reset issues encountered.
Cause
This issue can occur due to several potential causes:
Connection handling: The
requests
library andpycurl
handle connections differently:- requests uses a higher-level abstraction with automatic connection pooling
pycurl
uses the lower-levellibcurl
library, which provides more robust connection handling
User-Agent headers: The default User-Agent differs between
pycurl
andrequests
libraries, which can affect how certain API endpoints respondTLS/SSL Handshake:
pycurl
uses the system's SSL libraries directly, which can better handle certain TLS negotiation scenarios.