Description
When running my python script (in an AWS fargate container) I get an invalid port error httpx.InvalidURL: Invalid port: '"https:'
when trying to connect with my cloud cluster. When I run my script locally it works just fine, read and writes with no issue.
My cloud url env var is formatted like following, just copied directly from the cloud settings:
WEAVIATE_URL=https://CLUSTER_ID_HERE.c0.us-central1.gcp.weaviate.cloud
This is how I am creating a client:
WEAVIATE_URL = os.getenv("WEAVIATE_URL", "")
WEAVIATE_API_KEY = os.getenv("WEAVIATE_API_KEY", "")
client = weaviate.connect_to_weaviate_cloud(
cluster_url=WEAVIATE_URL,
auth_credentials=Auth.api_key(WEAVIATE_API_KEY),
)
I have dropped in print statements to confirm the env var is getting pulled in correctly, which it is.
Server Setup Information
-
Weaviate Server Version:
-
1.25.10
-
Deployment Method:
-
AWS fargate under ECS and ECR
-
Multi Node? Number of Running Nodes:
-
Client Language and Version:
-
Multitenancy?:
Any additional Information
Full cloudwatch logs:
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_urlparse.py", line 346, in normalize_port
2024-08-13T17:33:10.665Z
port_as_int = int(port)
2024-08-13T17:33:10.665Z
ValueError: invalid literal for int() with base 10: '"https:'
2024-08-13T17:33:10.665Z
During handling of the above exception, another exception occurred:
2024-08-13T17:33:10.665Z
Traceback (most recent call last):
2024-08-13T17:33:10.665Z
File "/app/src/main.py", line 5, in <module>
2024-08-13T17:33:10.665Z
from utils import process_batch
2024-08-13T17:33:10.665Z
File "/app/src/utils.py", line 19, in <module>
2024-08-13T17:33:10.665Z
client = weaviate.connect_to_weaviate_cloud(
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py", line 79, in connect_to_weaviate_cloud
2024-08-13T17:33:10.665Z
return __connect(
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py", line 410, in __connect
2024-08-13T17:33:10.665Z
raise e
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py", line 406, in __connect
2024-08-13T17:33:10.665Z
client.connect()
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/syncify.py", line 23, in sync_method
2024-08-13T17:33:10.665Z
return _EventLoopSingleton.get_instance().run_until_complete(
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/event_loop.py", line 40, in run_until_complete
2024-08-13T17:33:10.665Z
return fut.result()
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 446, in result
2024-08-13T17:33:10.665Z
return self.__get_result()
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
2024-08-13T17:33:10.665Z
raise self._exception
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/client_base.py", line 152, in connect
2024-08-13T17:33:10.665Z
await self._connection.connect(self._skip_init_checks)
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py", line 158, in connect
2024-08-13T17:33:10.665Z
meta = await self.get_meta()
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py", line 587, in get_meta
2024-08-13T17:33:10.665Z
response = await self.get(path="/meta")
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py", line 546, in get
2024-08-13T17:33:10.665Z
return await self.__send(
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py", line 467, in __send
2024-08-13T17:33:10.665Z
raise e
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py", line 448, in __send
2024-08-13T17:33:10.665Z
req = self._client.build_request(
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 345, in build_request
2024-08-13T17:33:10.665Z
url = self._merge_url(url)
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 375, in _merge_url
2024-08-13T17:33:10.665Z
merge_url = URL(url)
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_urls.py", line 115, in __init__
2024-08-13T17:33:10.665Z
self._uri_reference = urlparse(url, **kwargs)
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_urlparse.py", line 248, in urlparse
2024-08-13T17:33:10.665Z
parsed_port: int | None = normalize_port(port, scheme)
2024-08-13T17:33:10.665Z
File "/usr/local/lib/python3.9/site-packages/httpx/_urlparse.py", line 348, in normalize_port
2024-08-13T17:33:10.665Z
raise InvalidURL(f"Invalid port: {port!r}")
2024-08-13T17:33:10.665Z
httpx.InvalidURL: Invalid port: '"https:'
httpx.InvalidURL: Invalid port: '"https:'
Docker compose file in the repo, though this part confuses me as I don’t see why we need this. Before we were running a local cluster, but have since changed to use the weaviate cloud service. So seems like this isn’t doing anything. I’m new to Vector DBs and rubbish with Docker… sorry.
---
version: '3.4'
services:
weaviate:
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
- http
image: cr.weaviate.io/semitechnologies/weaviate:1.25.5
ports:
- 8080:8080
- 50051:50051
volumes:
- weaviate_data:/var/lib/weaviate
restart: on-failure:0
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
DEFAULT_VECTORIZER_MODULE: ''
ENABLE_MODULES: ''
CLUSTER_HOSTNAME: 'node1'
volumes:
weaviate_data:
...