Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError (undefined method `to_sym' for nil:NilClass) when fetching Node #1663

Open
michalkorzawski opened this issue Sep 27, 2021 · 8 comments
Labels

Comments

@michalkorzawski
Copy link

michalkorzawski commented Sep 27, 2021

Hi

I have an issue with fetching data - all operation like Model.first, Model.last, Model.find_by(name: 'some name') ends up with error NoMethodError (undefined method `to_sym' for nil:NilClass)

BUT when I copy/paste ActiveGraph::Core::Schema from activegraph source code to my app and in application.rb I'm loading this code like this:

overrides = "#{Rails.root}/app/services/active_graph"

Rails.autoloaders.main.ignore(overrides)

config.to_prepare do
  Dir.glob("#{overrides}/**/*.rb").each do |override|
    load override
  end
end

everything is working fine

label(keys, row) from below's method is causing this error (only then I'm not including this code in my rails app)

def indexes
        raw_indexes do |keys, result|
          result.map do |row|
            { type: row[:type].to_sym, label: label(keys, row), properties: properties(row), state: row[:state].to_sym }
          end
        end
      end
gem 'activegraph', '~> 10.1'
gem 'neo4j-ruby-driver', '~> 1.7', '>= 1.7.5'

I run neo4j db as a docker image

Do you know why could it be?

@harmjanblok
Copy link

Might be related, activegraph 10 doesn't seem to support neo4j above 4.0. 😢

@amitsuryavanshi
Copy link
Member

@michalkorzawski Is there any specific INDEX in DB which is causing this issue?

@jeperkins4
Copy link

We are also running into this issue on Neo4j 4.4.0 (a co-workers instance), but I don't seem to have the issue running 4.2.1. We are going to attempt to downgrade to 4.2.12 on the co-workers instance.

@lukestadtler
Copy link

lukestadtler commented Dec 23, 2021

I also ran into this issue and the underlying issue is the 2 seemingly default indexes in the neo4j db.
def label(result, row)
if v34?(result)
row[:label]
else
(v4?(result) ? row[:labelsOrTypes] : row[:tokenNames]).first # this code is accessing the first element of the index's empty labelsOrTypes array
end.to_sym
end

Screen Shot 2021-12-23 at 3 28 37 PM

I'm not sure exactly what creates these indexes, if they're necessary/default etc? But these are in the default neo4j docker image database, and in my neo4j desktop generated db as well.

Should activegraph be able to assume these to be empty? / for the label to be nil?

@SabretWoW
Copy link

SabretWoW commented Mar 8, 2022

Might be related, activegraph 10 doesn't seem to support neo4j above 4.0. 😢

Any idea when it will? I'm having the same issue trying to connect to AuraDB and I'm DYING to use Neo4j in my Rails 7 app. Please help :)

Can I downgrade to a version that is supported with AuraDB? I have bolt installed too. Just can't figure this out.

@amitsuryavanshi
Copy link
Member

I assume this has been fixed with #1669

@mech
Copy link

mech commented Apr 4, 2022

Can I confirm that this gem is not supported on AuraDB with v4?

Using the connection string like: neo4j+s://XXX.databases.neo4j.io throw:

Neo4j::Driver::Exceptions::ClientException: Unsupported URI scheme: neo4j+s

Is this only for JRuby and not MRI development?

@michalkorzawski
Copy link
Author

@amitsuryavanshi switching to
gem 'activegraph', git: 'https://github.com/neo4jrb/activegraph', branch: '10'`
resolved this issue,
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants