devise-activegraph icon indicating copy to clipboard operation
devise-activegraph copied to clipboard

Upgrading to neo4j.rb 8.0 and neo4j-core 7.0.0 breaks Devise code

Open Grace opened this issue 9 years ago • 3 comments

NoMethodError in Devise::SessionsController#create

Extracted source (around line #62):

60 list = response.body || [] 61 list.map do |item| 62 {type: CONSTRAINT_TYPES[item[:type]], 63 label: item[:label].to_sym, 64 properties: item[:property_keys].map(&:to_sym)}

Fulltrace:

neo4j-core (7.0.0) lib/neo4j/core/cypher_session/adaptors/http.rb:62:in `constraints'
neo4j-core (7.0.0) lib/neo4j/core/cypher_session.rb:36:in `block (2 levels) in <class:CypherSession>'
neo4j (8.0.0) lib/neo4j/model_schema.rb:35:in `model_constraints'
neo4j (8.0.0) lib/neo4j/model_schema.rb:131:in `each_schema_element'
neo4j (8.0.0) lib/neo4j/model_schema.rb:94:in `validate_model_schema!'
neo4j (8.0.0) lib/neo4j/active_base.rb:78:in `validate_model_schema!'
neo4j (8.0.0) lib/neo4j/active_base.rb:50:in `new_query'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy.rb:305:in `_query'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy.rb:290:in `_query_model_as'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy.rb:113:in `base_query'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy.rb:98:in `query_as'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy.rb:87:in `query'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy_methods.rb:253:in `first_and_last'
neo4j (8.0.0) lib/neo4j/active_node/query/query_proxy_methods.rb:31:in `first'
neo4j (8.0.0) lib/neo4j/active_node/orm_adapter.rb:42:in `find_first'
devise (4.2.0) lib/devise/models/authenticatable.rb:267:in `find_first_by_auth_conditions'
devise (4.2.0) lib/devise/models/authenticatable.rb:263:in `find_for_authentication'
devise (4.2.0) lib/devise/models/database_authenticatable.rb:162:in `find_for_database_authentication'
devise (4.2.0) lib/devise/strategies/database_authenticatable.rb:8:in `authenticate!'
warden (1.2.6) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.2.6) lib/warden/proxy.rb:358:in `block in _run_strategies_for'
warden (1.2.6) lib/warden/proxy.rb:353:in `each'
warden (1.2.6) lib/warden/proxy.rb:353:in `_run_strategies_for'
warden (1.2.6) lib/warden/proxy.rb:323:in `_perform_authentication'
warden (1.2.6) lib/warden/proxy.rb:127:in `authenticate!'
devise (4.2.0) app/controllers/devise/sessions_controller.rb:17:in `create'
actionpack (5.0.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:188:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
searchkick (1.4.1) lib/searchkick/logging.rb:153:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
neo4j (8.0.0) lib/neo4j/migrations/check_pending.rb:16:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
request_store (1.3.1) lib/request_store/middleware.rb:9:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'

Grace avatar Dec 18 '16 02:12 Grace

Hey @Grace thanks for the report! I'm actually cleaning up a bit of stuff in this gem right now, so I'll have a look at this shortly!

cheerfulstoic avatar Dec 19 '16 14:12 cheerfulstoic

I've looked a bit and I'm wondering what version of Neo4j are you using?

It seems that this is failing in the place where version 8.0 of the neo4j gem is trying to figure out what constraints are in the database so that it can validate that your app has the constraints it needs. I'm wondering if the version of your Neo4j database is affecting the response from db/data/schema/constraint

cheerfulstoic avatar Dec 19 '16 17:12 cheerfulstoic

I think I've fixed this (or at least made it better). There was an issue where Neo4j was returning an error when the gem was trying to get constraints or indexes which was simply causing the gem's code to trip up. That error should now be raised as an exception. Try running:

bundle update neo4j neo4j-core

At that point you should get a CypherSession::ConnectionFailedError exception with more information from Neo4j on what is wrong

cheerfulstoic avatar Dec 23 '16 15:12 cheerfulstoic