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

[FEATURE] Add support for AWSV4SignerAuth for Urllib3HttpConnection #546

Closed
navneet1v opened this issue Oct 20, 2023 · 0 comments · Fixed by #547
Closed

[FEATURE] Add support for AWSV4SignerAuth for Urllib3HttpConnection #546

navneet1v opened this issue Oct 20, 2023 · 0 comments · Fixed by #547
Assignees
Labels
enhancement New feature or request

Comments

@navneet1v
Copy link

What is the bug?

I have a domain created with Amazon Opensearch with IAM authentication enabled. I am trying access domain using default connection class with AWSV4SignerAuth.

Opensearch-py version:

opensearch-py==2.3.2
python = 3.8

How can one reproduce the bug?

  1. Create a domain with Amazon OpenSearch.
  2. Enable IAM authentication on the domain.
  3. Try accessing the domain using default connection class(Urllib3HttpConnection) with AWSV4SignerAuth.

What is the expected behavior?

As the default connection class is better as compared to RequestsHttpConnection, as provided in the issue: #535

If I use RequestsHttpConnection, there is no exception.

What is your host/environment?

Amazon OpenSearch version 2.9

Do you have any screenshots?

Pasting logs:

File "main.py", line 60, in main
    client = create_os_client(host=args.endpoint, service=cmd_args.service)
  File "/Volumes/workplace/JunoKNNBenchmarks/src/JunoKNNBenchmarks/benchmarks/hybrid-search/src/opensearch/os_helper.py", line 13, in create_os_client
    client = OpenSearch(
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/opensearchpy/client/__init__.py", line 190, in __init__
    self.transport = transport_class(_normalize_hosts(hosts), **kwargs)
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/opensearchpy/transport.py", line 164, in __init__
    self.set_connections(hosts)
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/opensearchpy/transport.py", line 218, in set_connections
    connections = list(zip(connections, hosts))
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/opensearchpy/transport.py", line 214, in _create_connection
    return self.connection_class(**kwargs)
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/opensearchpy/connection/http_urllib3.py", line 134, in __init__
    self.headers.update(urllib3.make_headers(basic_auth=http_auth))
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/urllib3/util/request.py", line 85, in make_headers
    headers["authorization"] = "Basic " + b64encode(b(basic_auth)).decode("utf-8")
  File "/Users/navneev/miniforge3/envs/knn-perf/lib/python3.8/site-packages/urllib3/packages/six.py", line 687, in b
    return s.encode("latin-1")
AttributeError: 'AWSV4SignerAuth' object has no attribute 'encode'

Do you have any additional context?

NA

@navneet1v navneet1v added bug Something isn't working untriaged Need triage labels Oct 20, 2023
@dblock dblock changed the title [BUG] Getting exception while using default connection class(Urllib3HttpConnection) with AWSV4SignerAuth [BUG] Add support for AWSV4SignerAuth for Urllib3HttpConnection Oct 20, 2023
@dblock dblock changed the title [BUG] Add support for AWSV4SignerAuth for Urllib3HttpConnection [FEATURE] Add support for AWSV4SignerAuth for Urllib3HttpConnection Oct 20, 2023
@dblock dblock removed bug Something isn't working untriaged Need triage labels Oct 20, 2023
@dblock dblock self-assigned this Oct 20, 2023
@dblock dblock added the enhancement New feature or request label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants