Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

irena's avatar
irena
New Contributor
3 years ago

Connect API connection error: Name or service not known

Hello,

I am trying to use the OnePassword SDK for Python, however when trying to get an item a connection error is occurring.

The client creation is as follows:

self.api_client: Client = new_client(self.api_host, self.token)

where the values for api_host and token is matching the ENV VAR values OP_CONNECT_HOST and OP_CONNECT_TOKEN from the connect server deployment. Please note that the Connect Server and Operator deployment work as expected.

There is no error when creating the client itself, but when trying to use it the first time:

self.api_client.get_item(item_id, vault_id)

requests.exceptions.ConnectionError: HTTPConnectionPool(host='onepassword-connect', port=8080): Max retries exceeded with url: /v1/vaults/kzkqpu44pencnzsrkjx6rgaz5m/items/zsap3pmz7agzo7gsx5rhac2tqy (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known'))

An additional information is that the service from which I am trying to use the python api client is in a separate namespace then the connect server namespace is deployed to, but both namespaces are in the same Kubernetes cluster. No TLS has been used when deploying the Connect server an operator.

Apart from using host value of http://onepassword-connect:8080, I also tried using http://connect-api:8080 as per your documentation on https://github.com/1Password/connect-sdk-python, however same error happens...

I don't see what could be wrong with the client usage. Any advice what else to to try?

Thanks in advance
Irena


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

  • irena's avatar
    irena
    New Contributor

    I had another try where I replaced the hostname with the pod IP address, and then the get item call worked. Obviously, I cannot use the IP address in production, so I still need help in resolving this issue.