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

TypeError when connecting via insecure GRPC and with API key #179

Closed
ArthurMelin opened this issue Jun 1, 2023 · 2 comments
Closed

TypeError when connecting via insecure GRPC and with API key #179

ArthurMelin opened this issue Jun 1, 2023 · 2 comments

Comments

@ArthurMelin
Copy link
Contributor

Hello,
The grpc library throws the following exception when attempting to connect via insecure GRPC and with an API key:

Python 3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from qdrant_client import QdrantClient
>>> client = QdrantClient(host="qdrant", https=False, prefer_grpc=True, api_key="foobar")
/usr/local/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py:104: UserWarning: Api key is used with unsecure connection.
  warnings.warn("Api key is used with unsecure connection.")
>>> client.get_collections()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/qdrant_client/qdrant_client.py", line 1130, in get_collections
    return self._client.get_collections(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py", line 1489, in get_collections
    response = self.grpc_collections.List(
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py", line 217, in grpc_collections
    self._init_grpc_collections_client()
  File "/usr/local/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py", line 159, in _init_grpc_collections_client
    self._grpc_channel = get_channel(
                         ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/qdrant_client/connection.py", line 214, in get_channel
    channel = grpc.insecure_channel(f"{host}:{port}", metadata, options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/grpc/__init__.py", line 1964, in insecure_channel
    return _channel.Channel(target, () if options is None else options, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/grpc/_channel.py", line 1649, in __init__
    _common.encode(target), _augment_options(core_options, compression),
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/grpc/_channel.py", line 1605, in _augment_options
    compression_option = _compression.create_channel_option(compression)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/grpc/_compression.py", line 46, in create_channel_option
    int(compression)),) if compression else ()
    ^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'

Looks like the problem comes from here:

channel = grpc.insecure_channel(f"{host}:{port}", metadata, options)

The metadata arg shouldn't be here, after removing it the problem was resolved.

Let me know if you want me to make a PR!

@longma8520
Copy link

Can it be fixed ASAP?

@joein
Copy link
Member

joein commented Jul 22, 2023

should be fixed with #216, should be available in the upcoming release

@joein joein closed this as completed Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants