# Invalid port - aws

**URL:** <https://forum.weaviate.io/t/invalid-port-aws/3345>\
**Category:** Support\
**Tags:** wcs, python\
**Created:** [August 13, 2024, 11:00pm UTC](https://forum.weaviate.io/t/invalid-port-aws/3345 "2024-08-13T23:00:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jadam](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jadam/32/1780_2.png) [@jadam](https://forum.weaviate.io/u/jadam)\
**Post date:** [August 13, 2024, 11:00pm UTC](https://forum.weaviate.io/t/invalid-port-aws/3345/1 "2024-08-13T23:00:38Z")

</div>

### 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:

```auto
    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:

```auto
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.

```auto
---
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:
...

```

---

<div class="post-metadata">

**Author:** ![jadam](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jadam/32/1780_2.png) [@jadam](https://forum.weaviate.io/u/jadam)\
**Post date:** [August 14, 2024, 3:37pm UTC](https://forum.weaviate.io/t/invalid-port-aws/3345/2 "2024-08-14T15:37:21Z")

</div>

SOLVED ✅

So dumb, it was how env vars were being set in AWS. They were set using the Secret Managers default “Key/value” option rather than the “Plaintext” option. 😑

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [August 15, 2024, 6:24pm UTC](https://forum.weaviate.io/t/invalid-port-aws/3345/3 "2024-08-15T18:24:11Z")

</div>

Hi @jadam !!

THanks for sharing 🙂
