neo4jrb / activegraph

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

uninitialized constant ActiveGraph::Config (NameError) #1595

Open namiwang opened 4 years ago

namiwang commented 4 years ago

I'm trying to upgrade to v10 (for neo4j 4.0 support) and got a lot of issues while setting up the project.

repro

  1. create a blank new rails app
  2. add gem 'activegraph', github: 'neo4jrb/activegraph', branch: 'master' in Gemfile and bundle (which is commit #e387298980351d67029274b696c4672434d1f51a)
  3. add require 'active_graph/railtie' in application.rb

unexpected behavior

/Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant ActiveGraph::Config (NameError)
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
    from /Users/user/.rvm/gems/ruby-2.7.0/bundler/gems/activegraph-e38729898035/lib/active_graph/railtie.rb:51:in `block in <class:Railtie>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in `each'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in `call'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
    from /Users/user/workspace/app/app/config/environment.rb:5:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
klobuczek commented 4 years ago

@namiwang I was able to bypass the issue by adding:

require 'active_graph'

to application.rb. I cannot explain the reason. It works on our rails app (5.2.3) without it. If you find out please let me know. BTW you don't need to use the activegraph gem from github source. Any significant change is immediately pushed to rubygems.org as beta version.

namiwang commented 4 years ago

@klobuczek Thanks for the response.

I got another error cannot load such file -- neo4j_ruby_driver, After added require 'active_garph'.

I guess it's all somehow related to the new loading mechanics introduced in rails 6.


update:

So I tried to add gem 'neo4j-ruby-driver', and got a new error, apparently that's unrelated to this issue though.

/Users/user/.rvm/gems/ruby-2.7.0/gems/ffi-1.12.2/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'libseabolt17': dlopen(libseabolt17, 5): image not found.
Could not open library 'libseabolt17.dylib': dlopen(libseabolt17.dylib, 5): image not found (LoadError)
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/ffi-1.12.2/lib/ffi/library.rb:99:in `map'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/ffi-1.12.2/lib/ffi/library.rb:99:in `ffi_lib'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/bolt/library.rb:9:in `extended'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/bolt/address_resolver.rb:5:in `extend'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/bolt/address_resolver.rb:5:in `<module:AddressResolver>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/bolt/address_resolver.rb:4:in `<module:Bolt>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/bolt/address_resolver.rb:3:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `const_get'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `block (2 levels) in eager_load'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:723:in `block in ls'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `foreach'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `ls'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:376:in `block in eager_load'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `synchronize'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `eager_load'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/lib/loader.rb:16:in `load'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/ffi/neo4j/driver.rb:56:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/neo4j-ruby-driver-0.3.4/lib/neo4j_ruby_driver.rb:20:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activegraph-10.0.0.pre.beta.3/lib/active_graph/core.rb:7:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activegraph-10.0.0.pre.beta.3/lib/active_graph.rb:4:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /Users/user/workspace/app/app/config/application.rb:18:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:92:in `require'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:92:in `preload'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
    from /Users/user/.rvm/gems/ruby-2.7.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
    from /Users/user/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
mhanberg commented 4 years ago

I saw this same error, and when adding the call to require 'active_graph', I am now seeing a zeitwerk error about ActiveModel

/Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require': cannot load such file -- active_model/attribute_set (LoadError)
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/activegraph-10.0.0.pre.beta.3/lib/active_graph/lazy_attribute_hash.rb:1:in `<top (required)>'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/activegraph-10.0.0.pre.beta.3/lib/active_graph.rb:18:in `<top (required)>'
        from /Users/mitchellhanberg/Development/myapp/config/application.rb:8:in `require'
        from /Users/mitchellhanberg/Development/myapp/config/application.rb:8:in `<top (required)>'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /Users/mitchellhanberg/.asdf/installs/ruby/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from -e:1:in `<main>'
danteay commented 3 years ago

I get a full solution by installing this driver: https://github.com/neo4j-drivers/seabolt/releases

jacek213 commented 3 years ago

@mhanberg any luck with solving active model error?

mhanberg commented 3 years ago

I may have solved it locally, but we have since re-written this service in Elixir. Sorry, wish I could offer more help 😕.

Sent from my iPhone

On Nov 29, 2020, at 2:30 PM, jacek213 notifications@github.com wrote:

 @mhanberg any luck with solving active model error?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jacek213 commented 3 years ago

No worries, thanks the feedback :+1:

@klobuczek maybe you'd be able to help? I'm trying to migrate from 9.x to 10. I see that activemodel is locked at >= 4.0 for this gem and I'm currently running v5.1.6.

cknoxrun commented 3 years ago

Also chasing this problem trying to migrate. I have a Rails 6 branch in the works (same codebase), where this error doesn't occur, so I imagine it is a Rails 5.1 (possibly 5.2) issue.

Edit: Just noticed active_model/attribute_set does not exist until Rails 5.2, so I imagine that is definitely the issue. I would suggest setting the minimum Rails version for ActiveGraph at 5.2.

nomasprime commented 1 year ago

After spending almost two days reinstalling various versions of Ruby and Rails to try and get various Neo4J gems to work, I can state that Neo4J does not love Ruby 😆

There's still no solution for a three year old issue?

mazaira commented 1 year ago

Same here for Rails 7 and Ruby 3.2

pmackay commented 11 months ago

I would also appreciate some guidance on this issue.