Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) #3312

Closed
isdefic opened this issue Apr 19, 2017 · 1 comment
Assignees

Comments

@isdefic
Copy link

isdefic commented Apr 19, 2017

Hi all,

I'm trying to use google-cloud-python to get the content of my bucket and save in a S3 bucket using an aws lambda function.

I've been having issues with the SSL certificate validation and after trying few things I have zero results.

My script is:

from google.cloud import storage

def lambda_handler(event, context):
    # Instantiates a client
    storage_client = storage.Client()

    # The name for the new bucket
    bucket_name = 'xxx'

    # Creates the new bucket
    bucket_data = storage_client.get_bucket(bucket_name)

    blobs = bucket_data.list_blobs()

    for blob in blobs:
        print(blob.name)

and the error I get is:

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590): TransportError
Traceback (most recent call last):
  File "/var/task/doubleclick_ingestor.py", line 25, in lambda_handler
    bucket_data = storage_client.get_bucket(bucket_name)
  File "/var/task/google/cloud/storage/client.py", line 173, in get_bucket
    bucket.reload(client=self)
  File "/var/task/google/cloud/storage/_helpers.py", line 99, in reload
    _target_object=self)
  File "/var/task/google/cloud/_http.py", line 299, in api_request
    headers=headers, target_object=_target_object)
  File "/var/task/google/cloud/_http.py", line 193, in _make_request
    return self._do_request(method, url, headers, data, target_object)
  File "/var/task/google/cloud/_http.py", line 223, in _do_request
    body=data)
  File "/var/task/google_auth_httplib2.py", line 187, in request
    self._request, method, uri, request_headers)
  File "/var/task/google/auth/credentials.py", line 118, in before_request
    self.refresh(request)
  File "/var/task/google/oauth2/service_account.py", line 310, in refresh
    request, self._token_uri, assertion)
  File "/var/task/google/oauth2/_client.py", line 143, in jwt_grant
    response_data = _token_endpoint_request(request, token_uri, body)
  File "/var/task/google/oauth2/_client.py", line 104, in _token_endpoint_request
    method='POST', url=token_uri, headers=headers, body=body)
  File "/var/task/google_auth_httplib2.py", line 119, in __call__
    raise exceptions.TransportError(exc)
TransportError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

Any help would be appreciated.

Thanks,
Isaura

@dhermes
Copy link
Contributor

dhermes commented Apr 19, 2017

@isdefic We've seen this quite a bit because httplib2 is not threadsafe (see #1214).

I'm closing this for now, with the assumption that you are sharing a Client across multiple threads. If that isn't the case, let us know and I'll re-open and we can discuss. (As it turns out I am very close to ripping out httplib2 as a dependency.)

Assuming you are using this library in multiple threads, create a thread-local Client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants