neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.39k stars 276 forks source link

Using a Neo4j Aura URL throws an error #1635

Closed sjmog closed 3 years ago

sjmog commented 3 years ago

When connecting ActiveGraph to a Neo4j Aura URL (e.g. neo4j+s://xxxxxxxx.databases.neo4j.io), we get the following error:

remote: Neo4j::Driver::Exceptions::ClientException: Unsupported URI scheme: neo4j+s
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/ffi/neo4j/driver/internal/driver_factory.rb:103:in `scheme'
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/ffi/neo4j/driver/internal/driver_factory.rb:91:in `set_scheme'
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/ffi/neo4j/driver/internal/driver_factory.rb:29:in `create_connector'
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/ffi/neo4j/driver/internal/driver_factory.rb:16:in `new_instance'
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/ffi/neo4j/driver/graph_database.rb:26:in `driver'
remote: /app/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.2/lib/neo4j/driver/auto_closable.rb:16:in `block (3 levels) in with_block_definer'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/railtie.rb:75:in `setup!'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/railtie.rb:53:in `block (2 levels) in <class:Railtie>'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/base.rb:29:in `establish_driver'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/base.rb:19:in `driver'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/transactions.rb:37:in `send_transaction'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/transactions.rb:21:in `transaction'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/base.rb:33:in `query'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/core/schema.rb:20:in `constraints'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/core/label.rb:79:in `constraints'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/core/label.rb:91:in `constraint?'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/migrations/runner.rb:17:in `initialize'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/tasks/migration.rake:117:in `new'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/tasks/migration.rake:117:in `block (3 levels) in <main>'
remote: /app/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.1/lib/active_graph/tasks/migration.rake:45:in `block (2 levels) in <main>'

Additional information which could be helpful if relevant to your issue:

Code example (inline, gist, or repo)

In application.rb, with the ENV vars set:

config.neo4j.driver.url = ENV['NEO4J_AURA_URL'] || 'neo4j://localhost:7474'
config.neo4j.driver.username = ENV['NEO4J_AURA_USER'] || 'user'
config.neo4j.driver.password = ENV['NEO4J_AURA_PASSWORD'] || 'password'

Runtime information:

Neo4j database version: 4 (oon neo4j Aura) neo4j-ruby-driver gem version: 1.7.2

sjmog commented 3 years ago

Looks like this can be trivially solved by removing the "+s" part of the URI, e.g. neo4j+s://xxxxxxxx.databases.neo4j.io -> neo4j://xxxxxxxx.databases.neo4j.io