Hello,
I am trying to connect to weaviate using loca_instance below is my code snippet:
self.client = weaviate.connect_to_local(
host="0.0.0.0", # Use a string to specify the host
port=8080,
grpc_port=50051,
headers=headers,
auth_credentials=AuthApiKey(weaviate_api_key)
)
I am running it using docker, my docker compose is as below:
eaviate:
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
- http
image: cr.weaviate.io/semitechnologies/weaviate:1.27.8
ports:
- 8080:8080
- 50051:50051
volumes:
- weaviate_data:/var/lib/weaviate
restart: on-failure:0
env_file: .env
healthcheck:
test: wget --no-verbose --tries=3 --spider http://localhost:8080/v1/.well-known/ready || exit 1
interval: 5s
timeout: 10s
retries: 5
start_period: 10s
I am getting below error for connecting to weaviate
Traceback (most recent call last):
File β/usr/local/lib/python3.12/site-packages/starlette/routing.pyβ, line 693, in lifespan
async with self.lifespan_context(app) as maybe_state:
^^^^^^^^^^^^^^^^^^^^^^^^^^
File β/usr/local/lib/python3.12/contextlib.pyβ, line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File β/app/app.pyβ, line 57, in lifespan
await weaviate_app.setup()
File β/app/weaviate_manager/manager.pyβ, line 51, in setup
self.client = weaviate.connect_to_local(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File β/usr/local/lib/python3.12/site-packages/weaviate/connect/helpers.pyβ, line 210, in connect_to_local
return __connect(
^^^^^^^^^^
File β/usr/local/lib/python3.12/site-packages/weaviate/connect/helpers.pyβ, line 411, in __connect
raise e
File β/usr/local/lib/python3.12/site-packages/weaviate/connect/helpers.pyβ, line 407, in __connect
client.connect()
File β/usr/local/lib/python3.12/site-packages/weaviate/syncify.pyβ, line 23, in sync_method
return _EventLoopSingleton.get_instance().run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File β/usr/local/lib/python3.12/site-packages/weaviate/event_loop.pyβ, line 42, in run_until_complete
return fut.result()
^^^^^^^^^^^^
File β/usr/local/lib/python3.12/concurrent/futures/_base.pyβ, line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File β/usr/local/lib/python3.12/concurrent/futures/_base.pyβ, line 401, in __get_result
raise self._exception
File β/usr/local/lib/python3.12/site-packages/weaviate/client_base.pyβ, line 153, in connect
await self._connection.connect(self._skip_init_checks)
File β/usr/local/lib/python3.12/site-packages/weaviate/connect/v4.pyβ, line 177, in connect
raise WeaviateStartUpError(f"Could not connect to Weaviate:{e}.") from e
weaviate.exceptions.WeaviateStartUpError: Could not connect to Weaviate:Connection to Weaviate failed. Details: .
when I checked logs for container, I understood that my weaviate is running but not able to connect.
can u pl check the issue.
Am I missing anything or doing wrong ?