Helm chart neo4j cluster - cannot resolve address

I installed neo4j cluster in my namespace with helm chart.
When I am trying to connect to the cluster and run any opertion I get this error meesage:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/neo4j/addressing.py", line 110, in _dns_resolve
    info = getaddrinfo(address.host, address.port, family, SOCK_STREAM)
  File "/usr/local/lib/python3.9/socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/neo4j/work/simple.py", line 209, in run
    self._connect(self._config.default_access_mode, database=self._config.database)
  File "/usr/local/lib/python3.9/site-packages/neo4j/work/simple.py", line 116, in _connect
    self._connection = self._pool.acquire(access_mode=access_mode, timeout=self._config.connection_acquisition_timeout, database=database)
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 880, in acquire
    connection = self._acquire(address, timeout=timeout)  # should always be a resolved address
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 413, in _acquire
    connection = self.opener(address, timeout)
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 576, in opener
    return Bolt.open(addr, auth=auth, timeout=timeout, routing_context=routing_context, **pool_config)
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 193, in open
    s, pool_config.protocol_version, handshake, data = connect(
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 1038, in connect
    for resolved_address in Address(address).resolve(resolver=custom_resolver):
  File "/usr/local/lib/python3.9/site-packages/neo4j/addressing.py", line 146, in resolve
    resolved.extend(self._dns_resolve(self, family))
  File "/usr/local/lib/python3.9/site-packages/neo4j/addressing.py", line 112, in _dns_resolve
    raise ValueError("Cannot resolve address {}".format(address))
ValueError: Cannot resolve address tomer18-neo4j-core-0.tomer18-neo4j.tomer18.svc.cluster.local:7687

I am using the neo4j DNS record to connect to the cluster (we did the same when we worked with standalone mode and it's worked without any problem).

What am I missing here?

Dan Yazerski

I am getting the same error when I port-forward and I try to connect localy.
but when I connect via neo4j browser everything works.

any idea why ?
I tried to upgrade the neo4j python library but I am getting the same error.

when i added these 3 records to the /etc/hosts it's worked: tomer21-neo4j-core-0.tomer18-neo4j.tomer21.svc.cluster.local tomer21-neo4j-core-1-tomer18-neo4j.tomer21.svc.cluster.local tomer21-neo4j-core-2-tomer18-neo4j.tomer21.svc.cluster.local

Any idea how can I do it automatically?

I saw this article - External Exposure of Neo4j Clusters when using client routing - Neo4j-Helm User Guide

but it's not my problem I cannot connect to the cluster when I am in the same namespace as the cluster.