We are having an issue connecting via the GraphDatabase.driver to a remote database running in a Kubernetes cluster. We can connect to the database fine using cypher-shell and the desktop/browser but we are unable to connect via the python driver. The full debug list is attached and at this point we are at our wits end. In the case below we are trying a basic non-encrypted connection, when we try with encryption we get an SSL error and the connection is terminated. It should also be noted that this process is not running in a container but on computers outside of the namespace, I would have thought a firewall issue but given we can connect using the same protocol from the desktop and cypher-shell running on the same machines we are kind of stumped at this point.
We do go through load balancers and port 443 is forwarded to 7687 on the pod.
Windows Version:
$ uname -a
MINGW64_NT-10.0-19045 LWFSKN6G3 3.5.4-395fda67.x86_64 2024-11-25 09:49 UTC x86_64 Msys
$ pip freeze | grep neo4j
neo4j==5.28.1
Python 3.12.9
neo4j version is 5.24.1 Community edition.
from neo4j import GraphDatabase, Driver, Session
from neo4j.debug import watch
watch("neo4j")
URI = "neo4j://uri:443"
AUTH = ("f10ctli", "password")
with GraphDatabase.driver(URI,
auth=AUTH,
#database="neo4j",
encrypted=False,
) as driver:
print("checking driver")
print(driver.verify_connectivity())
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,438 [#0000] _: created, routing address IPv4Address(('100.64.1.62', 443))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,438 [#0000] _: routing towards fixed database: neo4j
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,439 [#0000] _: pinning database: 'neo4j'
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,439 [#0000] _: acquire routing connection, access_mode='READ', database=AcquisitionD
atabase(name='neo4j', guessed=False)
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,439 [#0000] _: attempting to update routing table from IPv4Address(('100.64.1.62', 4
43))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,440 [#0000] _: in: 100.64.1.62:443
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,442 [#0000] _: dns resolver out: 100.64.1.62:443
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,442 [#0000] _: _acquire router connection, database='neo4j', address=ResolvedIPv4Add
ress(('100.64.1.62', 443))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,443 [#0000] _: trying to hand out new connection
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,443 [#0000] C: 100.64.1.62:443
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,445 [#F425] C: 0x6060B017
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,445 [#F425] C: 0x000001FF 0x00080805 0x00020404 0x00000003
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,656 [#F425] S: 100.64.1.62:443 ServiceUnavailable: Failed to read four
byte Bolt handshake response from server ResolvedIPv4Address(('100.64.1.62', 443)) (deadline Deadline(timeout=60.0))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,657 [#0000] _: deactivating address ResolvedIPv4Address(('100.64.1.62', 443))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,657 [#0000] _: table={}
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,658 [#0000] _: failed to fetch routing info from ResolvedIPv4Address(('100.64.1.62',
443))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,658 [#0000] _: deactivating address IPv4Address(('100.64.1.62', 443))
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,658 [#0000] _: table={}
[ERROR ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,658 Unable to retrieve routing information
[DEBUG ] [Thread 18344] [Task None ] 2025-02-26 14:13:48,659 [#0000] _: close
Traceback (most recent call last):
File "C:\Users\f10ctli\src\neo.py", line 16, in
print(driver.verify_connectivity())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\driver.py", line 1082, in verify_connectivity
self._get_server_info(session_config)
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\driver.py", line 1297, in _get_server_info
return session._get_server_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\work\session.py", line 183, in _get_server_info
self._connect(READ_ACCESS, liveness_check_timeout=0)
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\work\session.py", line 136, in _connect
super()._connect(
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\work\workspace.py", line 199, in _connect
self._connection = self.pool.acquire(**acquire_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\io_pool.py", line 1161, in acquire
self.ensure_routing_table_is_fresh(
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\io_pool.py", line 1084, in ensure_routing_table_is_fresh
self.update_routing_table(
File "C:\Users\f10ctli\AppData\Roaming\Python\Python312\site-packages\neo4j_sync\io_pool.py", line 1011, in update_routing_table
raise ServiceUnavailable("Unable to retrieve routing information")
neo4j.exceptions.ServiceUnavailable: Unable to retrieve routing information