plaid/plaid-python

HTTPSConnectionPool(host='sandbox.plaid.com', port=443) on ubuntu 20.04 python 3.8.10

akrv opened this issue · 3 comments

akrv commented

I am trying to deploy a flask server on a ubuntu machine.
my dev env is macOS and it works fine.

When I deploy the flask server with a reverse proxy and https termination using apache, I get this error.

staging env:
OS version: ubuntu 20.04
python version: python 3.8.10

I do not want to rewrite my own python requests based plaid API with verify false but just use this library.
any help would be appreciated.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2095, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2080, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/root/python/server.py", line 200, in create_link_token
    response = client.link_token_create(request_plaid)
  File "/usr/local/lib/python3.8/dist-packages/plaid/api_client.py", line 769, in __call__
    return self.callable(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/plaid/api/plaid_api.py", line 7404, in __link_token_create
    return self.call_with_http_info(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/plaid/api_client.py", line 831, in call_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.8/dist-packages/plaid/api_client.py", line 406, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/local/lib/python3.8/dist-packages/plaid/api_client.py", line 193, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.8/dist-packages/plaid/api_client.py", line 452, in request
    return self.rest_client.POST(url,
  File "/usr/local/lib/python3.8/dist-packages/plaid/rest.py", line 264, in POST
    return self.request("POST", url,
  File "/usr/local/lib/python3.8/dist-packages/plaid/rest.py", line 150, in request
    r = self.pool_manager.request(
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 79, in request
    return self.request_encode_body(
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 171, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/poolmanager.py", line 330, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 747, in urlopen
    return self.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 747, in urlopen
    return self.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 747, in urlopen
    return self.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sandbox.plaid.com', port=443): Max retries exceeded with url: /link/token/create (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

A few things you can try:

  1. Can you confirm that if you don't use the client libraries you don't experience this problem?
  2. Can you create a self-signed certificate? You can see some simple instructions for doing so here: https://github.com/plaid/pattern#testing-oauth

Same issue here with a very similar staging env. Spun up a plaid-node server while debugging and it seems to work flawlessly.

akrv commented

@phoenixy1 what I tried was to setup the ubuntu 18.04 server with python 3.7 and it worked.