janko / sequel-activerecord_connection

Allows Sequel to reuse Active Record's database connection
MIT License
137 stars 11 forks source link

Error when using rodauth-rails with ruby-oci8 #29

Closed k-graefenhain closed 1 month ago

k-graefenhain commented 1 month ago

I use rodauth-rails (1.15.0) with sequel-activerecord_connection (1.4.1) and sequel (5.84.0).

When trying to login I get the following error message: "undefined method `raw_oci_connection' for an instance of OCI8EnhancedAutoRecover"

I tried with ruby-oci8 (2.2.14) and (2.2.13 x64-mingw-ucrt). Any suggestions how I can solve the issue?

janko commented 1 month ago

The sequel-activerecord_connection gem should work with the Oracle Enhanced adapter. It seems the raw connection stopped getting properly initialized in the latest adapter releases, and that this might be fixed on master. Could you try pulling activerecord-oracle_enhanced-adapter from master and seeing if it fixes the issue? I might add a workaround either way, as it's been a while since the last adapter release.

k-graefenhain commented 1 month ago

Something is not compatible with activerecord-oracle_enhanced-adapter from master:

wrong number of arguments (given 4, expected 1..3)
`activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract_adapter.rb:74:in `initialize'
oracle-enhanced (b8821cf48ef5) lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:250:in `initialize'
oracle-enhanced (b8821cf48ef5) lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:76:in `new'
oracle-enhanced (b8821cf48ef5) lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:76:in `oracle_enhanced_connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `public_send'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `new_connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:700:in `checkout_new_connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:679:in `try_to_checkout_new_connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:640:in `acquire_connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:341:in `checkout'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `connection'
activerecord (7.0.8.4) lib/active_record/connection_adapters/abstract/connection_handler.rb:211:in `retrieve_connection'
activerecord (7.0.8.4) lib/active_record/connection_handling.rb:313:in `retrieve_connection'
activerecord (7.0.8.4) lib/active_record/connection_handling.rb:280:in `connection'
activerecord (7.0.8.4) lib/active_record/migration.rb:648:in `connection'
activerecord (7.0.8.4) lib/active_record/migration.rb:643:in `build_watcher'
activerecord (7.0.8.4) lib/active_record/migration.rb:625:in `block in call'
activerecord (7.0.8.4) lib/active_record/migration.rb:624:in `synchronize'
activerecord (7.0.8.4) lib/active_record/migration.rb:624:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.8.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.1) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
railties (7.0.8.4) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.8.4) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.8.4) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.5.2) lib/sprockets/rails/quiet_assets.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.9) lib/rack/method_override.rb:24:in `call'
rack (2.2.9) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.8.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.9) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
railties (7.0.8.4) lib/rails/engine.rb:530:in `call'
puma (6.4.2) lib/puma/configuration.rb:272:in `call'
puma (6.4.2) lib/puma/request.rb:100:in `block in handle_request'
puma (6.4.2) lib/puma/thread_pool.rb:378:in `with_force_shutdown'
puma (6.4.2) lib/puma/request.rb:99:in `handle_request'
puma (6.4.2) lib/puma/server.rb:464:in `process_client'
puma (6.4.2) lib/puma/server.rb:245:in `block in run'
puma (6.4.2) lib/puma/thread_pool.rb:155:in `block in spawn_thread'
janko commented 1 month ago

It appears that the Oracle adapter's master branch isn't compatible with Active Record 7.0, it's passing arguments to abstract adapter accepted only by AR 7.1+. I don't want to force people using rodauth-rails to upgrade Rails, especially since rodauth-rails officially supports Rails 5.0+, so I'll prepare a hotfix for sequel-activerecord_connection.

janko commented 1 month ago

I just pushed https://github.com/janko/sequel-activerecord_connection/commit/7f12a1eb2319015122b7a244069aecd2bd6062ed to the sequel-activerecord_connection master branch, would you mind testing it out?

k-graefenhain commented 1 month ago

Yes, with the actual version from the sequel-activerecord_connection master branch it works! Thanks a lot!

janko commented 1 month ago

Great, just released version 1.4.2 with this fix.