Sen
Sen

Reputation: 53

py2neo v4 cannot connect to Graphenedb

I am able to connect to graphenedb with version 3 (because I was not able to connect with v4), but after I reinstalled with v4 using the git install, I am not able to log in now. I am following the recommended login method from the documentation, and below is my code.

I am using ubuntu 16.04 and python version 3.5.2.

I have the account and password in the code, and since it's a test database, you can use it for testing. Thanks!

from py2neo import Graph

uri='bolt://hobby-decofbokkgfdgbkemhfoical.dbs.graphenedb.com:24786'
user='Sen'
pwd='b.QS1afdAYIUnb.FWIkIyENscjeVzMJ'

graph = Graph(uri, auth=(user, pwd), port=24786)

And the response is as such,

S: [CLOSE]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 89, in __new__
    inst = cls._instances[key]
KeyError: '8e260f1265ad91eb60c4ceb775be7ba2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "graphObjects.py", line 7, in <module>
    graph = Graph(uri, auth=(user, pwd), port=24786)
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 307, in __new__
    database = Database(uri, **settings)
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 98, in __new__
    user_agent=connection_data["user_agent"])
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/api.py", line 125, in driver
    return driver_class(uri, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 69, in __init__
    pool.release(pool.acquire())
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 44, in acquire
    return self.acquire_direct(self.address)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 453, in acquire_direct
    connection = self.connector(address, self.connection_error_handler)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 66, in connector
    return connect(address, security_plan.ssl_context, error_handler, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 707, in connect
    raise last_error
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 699, in connect
    connection = _handshake(s, resolved_address, der_encoded_server_certificate, error_handler, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 655, in _handshake
    raise ProtocolError("Connection to %r closed without handshake response" % (resolved_address,))
neo4j.exceptions.ProtocolError: Connection to ('54.86.53.94', 24786) closed without handshake response

Thanks!

Upvotes: 0

Views: 1924

Answers (1)

Rebecca Nelson
Rebecca Nelson

Reputation: 1296

Your Neo4J instance is using TLS for its bolt connection, but your py2neo is not.

That traceback is characteristic of trying to connect to a TLS server with a normal, unencrypted connection.

In order to fix this problem, tell py2neo that your bolt connection should use TLS by passing in secure=True to the initialization of your Graph instance:

graph = Graph(uri, auth=(user, pwd), port=24786, secure=True)

Upvotes: 3

Related Questions