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

[BUG-python/deployment] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate #5548

Closed
xiajing10 opened this issue Sep 30, 2024 · 3 comments · Fixed by #5789
Labels
area: python sdk Indicates that an issue or pull request is related to the Python SDK type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@xiajing10
Copy link

xiajing10 commented Sep 30, 2024

Describe the bug
In Argilla version 2+, httpx.Client is created by rg.Argilla class. However, with verify=False is added, still get Error ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1000)

After investigation, verify parameter is not passed to httpx.Client through Argilla class ( from v2.2.0), both verify=False and verify='some cert path' fail.

Stacktrace and Code to create the bug

import argilla as rg
client = rg.Argilla(api_url=<argilla_service_https_url>, api_key=<api_key>, verify=False)

Tried to test with create_http_client function

from argilla._api._http._client import create_http_client
client = create_http_client(api_url=<argilla_service_https_url>, api_key=<api_key>, verify=False)
print(client._transport._pool._ssl_context.verify_mode) 

output 2

Problem is from line

transport=httpx.HTTPTransport(retries=retries)

in create_http_client

After comment this line or add verify=client_args.pop("verify", True) into httpx.HTTPTransport, output of print(client._transport._pool._ssl_context.verify_mode) turns to 0

Expected behavior
Connection to https url success with rg.Argilla(..., verify=False)

Environment:

  • Argilla Version 2.2.0:
  • ElasticSearch Version 8.5.3:
@xiajing10
Copy link
Author

Tested Argilla version 2.1.0 and verify=False works fine.

@xiajing10 xiajing10 changed the title [BUG-python/deployment] verify=False parameter is not passed to httpx.Client through Argilla class (v2) [BUG-python/deployment] verify=False parameter is not passed to httpx.Client through Argilla class (v2.2.0) Sep 30, 2024
@xiajing10 xiajing10 changed the title [BUG-python/deployment] verify=False parameter is not passed to httpx.Client through Argilla class (v2.2.0) [BUG-python/deployment] verify=False parameter is not passed to httpx.Client through Argilla class ( from v2.2.0) Nov 6, 2024
@xiajing10 xiajing10 changed the title [BUG-python/deployment] verify=False parameter is not passed to httpx.Client through Argilla class ( from v2.2.0) [BUG-python/deployment] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate Nov 6, 2024
@xiajing10
Copy link
Author

xiajing10 commented Jan 8, 2025

@frascuchon @burtenshaw @gabrielmbmb

Hi! I found root cause was due to this commit f5ff647#diff-8f687cd6936979b7f45f8583478843e8304a317a28fd979598a0774dc91b9aa1
after adding retries in a customized transport

Similar discussion here encode/httpx#1867
httpx.HTTPTransport as a customized transport can overwrite user specified parameter.

Any suggestions to this? Thanks!

@frascuchon frascuchon added type: bug Indicates an unexpected problem or unintended behavior area: python sdk Indicates that an issue or pull request is related to the Python SDK labels Jan 10, 2025
@frascuchon frascuchon added this to the v2.7.0 milestone Jan 21, 2025
@frascuchon
Copy link
Member

Thanks for the feedback, @xiajing10!

I've created a PR solving this #5789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: python sdk Indicates that an issue or pull request is related to the Python SDK type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants