haystack-core-integrations icon indicating copy to clipboard operation
haystack-core-integrations copied to clipboard

Weaviate: Cannot initialize WeaviateDocumentStore due to connection issue

Open yip-kl opened this issue 1 year ago • 1 comments

Describe the bug This error is returned when I tried to follow the official documentation to connect to Weaviate managed cluster. Note: The documentation also has an problem, where url is not specified upon initialization of WeaviateDocumentStore

My code:

from haystack.utils.auth import Secret
from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore, AuthApiKey

auth_client_secret = AuthApiKey(Secret.from_token("MY_WEAVIATE_API_KEY"))
document_store = WeaviateDocumentStore(
    url='WEAVIATE_CLUSTER_URL',
    auth_client_secret=auth_client_secret
    )

Error:

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
...
        - gRPC is not enabled or incorrectly configured on the server with version v1.24.8 or the client
        - your connection is unstable or has a high latency. In this case you can:
            - increase init-timeout in `weaviate.connect_to_local(additional_config=wvc.init.AdditionalConfig(timeout=wvc.init.Timeout(init=X)))`
            - disable startup checks by connecting using `skip_init_checks=True`

To Reproduce Refer to the above

How this issue can be resolved Update the self._client as below

self._client = weaviate.connect_to_wcs(
            cluster_url=url,
            auth_credentials=auth_client_secret)

Then the WeaviateDocumentStore can be initialized as below

document_store = WeaviateDocumentStore(
    url="WEAVIATE_CLUSTER_URL",
    auth_client_secret=weaviate.auth.AuthApiKey('WEAVIATE_API_KEY')
    )

Describe your environment (please complete the following information):

  • OS: Windows
  • Haystack version: 2.0.1
  • Integration version: 2.0.0

yip-kl avatar Apr 16 '24 08:04 yip-kl

Unfortunately, I found the same bug while working on other stuff.

Doing something like this can fix the specific bug.

anakin87 avatar May 08 '24 16:05 anakin87

I just ran into this issue as well. Any temporary workarounds?

marcorei avatar May 24 '24 21:05 marcorei

There is an open PR with a possible fix: #624

anakin87 avatar May 24 '24 22:05 anakin87