activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

Neo4j 4.0.4 is not supported?

Open jihh opened this issue 4 years ago • 5 comments

I followed 'Setup' chapter to modify config/application.rb:

require 'neo4j/ratiltie'
...
config.neo4j.session.options = {ssl: false}
config.neo4j.session.type = :bolt
config.neo4j.session.url = 'bolt://neo4j:neo4j@localhost:7687'

and make a simple model Role.rb

class Role
    include Neo4j::ActiveNode
end

and excute Role.first in Rails console

Loading development environment (Rails 6.0.3.1)
irb(main):001:0> Role
=> Role
irb(main):002:0> Role.first
Traceback (most recent call last):
        1: from (irb):2
RuntimeError (Couldn't agree on a version (Sent versions [1, 0, 0, 0]))

if I change type from bolt to http

# config.neo4j.session.options = {ssl: false}
config.neo4j.session.type = :http
config.neo4j.session.url = 'http://neo4j:neo4j@localhost:7474'

That not work too.

irb(main):001:0> Role.first
 HTTP REQUEST: 229ms Get http://localhost:7474/db/data/schema/cnostraint (0 bytes)
Traceback (most recent call last):
        1: from (irb):1
Neo4j::Core::CypherSession::ConnectionFaildError (Connection failure: )
    status: 404

I notice Neo4j removed REST API after 3.5, and I don't like to replace Neo4j 4.x with 3.x. What can I do next?

Runtime information:

OS: Windows 7 Ruby: 2.6.5-p114 Rails: 6.0.3.1 Neo4j database version: Community 4.0.4 neo4j gem version: 9.6.2 neo4j-core gem version: 9.0.0

jihh avatar May 24 '20 07:05 jihh

I tried on my MAC. It's no problem, right?

2.6.3 :004 > Role.first
 BOLT UNSECURE: 6ms bolt://neo4j:...@localhost:7687
 BOLT UNSECURE: 102ms bolt://neo4j:...@localhost:7687
 BOLT UNSECURE: 2ms bolt://neo4j:...@localhost:7687
 BOLT UNSECURE: 1ms bolt://neo4j:...@localhost:7687
 BOLT UNSECURE: 2ms bolt://neo4j:...@localhost:7687
 BOLT UNSECURE: 2ms bolt://neo4j:...@localhost:7687
Traceback (most recent call last):
        1: from (irb):4
Neo4j::DeprecatedSchemaDefinitionError (          Some schema elements were defined by the model (which is no longer supported), but they do not exist in the database.  Run the following to create them if you haven't already:)

rake neo4j:generate_schema_migration[constraint,Role,uuid]


And then run `rake neo4j:migrate`

(zshell users may need to escape the brackets)

Runtime information:

OS: macOS Catalina 10.15.4 Ruby: 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] Rails: 6.0.2.1 Neo4j database version: Community 3.5.14 neo4j gem version: 9.6.2 neo4j-core gem version: 9.0.0

jihh avatar May 24 '20 07:05 jihh

@jihh As the error message says, you will need a DB constraint on Role#id . Kindly do as said in error message and let us know if there are still any issues. Thanks. rake neo4j:generate_schema_migration[constraint,Role,uuid] rake neo4j:migrate

amitsuryavanshi avatar Jun 02 '20 11:06 amitsuryavanshi

Hi @jihh, I had the same problem here. The problem is the version 4 of Neo4j. If you use version 3.5 you don't get the problem.

raphox avatar Jun 08 '20 18:06 raphox

I spent a lot of time to find out this problem was related to compatibility between version 9.6 and Neo4j 4. I thought about creating a PR to help other people who could have the same problem as me. But I saw here https://github.com/neo4jrb/activegraph/compare/v9.6.2...v10.0.0.pre.beta.11#diff-1eb9dd67f3fdb946a95aa3bcf645ca10R22 that this is already working on version 10 which is nearing completion.

raphox avatar Jun 10 '20 11:06 raphox

@jihh @raphox activegraph-10.0.0 is released. This is the only version compatible with neo4j 4.0. Please reread https://neo4jrb.readthedocs.io/. Quite a bit has changed.

klobuczek avatar Jul 10 '20 04:07 klobuczek