Makara latest + ruby 3: `NoMethodError: undefined method 'provide' for nil:NilClass`
Hey guys thanks for all the hard work, I'm wanting to upgrade a rails app to ruby 3 but am failing on makara:
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/mysql/database_statements.rb:19:in `query'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:102:in `query_values'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/schema_statements.rb:62:in `table_exists?'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/connection_wrapper.rb:105:in `method_missing'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/proxy.rb:135:in `block in method_missing'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/proxy.rb:186:in `block in any_connection'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/pool.rb:109:in `block in provide'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/active_record/connection_adapters/makara_abstract_adapter.rb:31:in `handle'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/pool.rb:108:in `provide'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/proxy.rb:185:in `any_connection'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/makara-0.6.0.pre/lib/makara/proxy.rb:133:in `method_missing'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/schema_migration.rb:26:in `table_exists?'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/schema_migration.rb:30:in `create_table'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1206:in `initialize'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1079:in `new'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1079:in `open'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:261:in `block (3 levels) in <main>'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:258:in `each'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:258:in `flat_map'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:258:in `block (2 levels) in <main>'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/bugsnag-6.17.0/lib/bugsnag/integrations/rake.rb:20:in `execute'
/usr/local/dev/<repo>/rails/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
I've tried on both rails 3.0/3.2 with both makara 5.1 and 0.6.0.pre:
database.yml config is:
development: &development
adapter: mysql2_makara
encoding: utf8mb4
database: <redacted>
pool: 5
username: <redacted>
password: <redacted>
host: <redacted>
port: 3306
timeout: 5000
strict: false
makara:
blacklist_duration: 5
primary_ttl: 5
primary_strategy: round_robin
sticky: true
connections:
- role: primary
host: <redacted>
- role: replica
host: <redacted>
This fails on first boot running
bundle exec rake db:abort_if_pending_migrations
but figure it'll be on anything attempting to first connect up to the DB via makara
@cr0mbly Did you solve this? Hitting the same error.
@wjessop Nope we ended up just removing makara in favor of rails implementation. It actually works fairly well as of 6.1 If you can I'd switch over to that.
@wjessop we got hit with the same, and Makara seems broken with ActiveRecord7.1+, so we created @olioex/janus-ar to solve the problem
Thanks @lloydwatkin, I'll check it out. I'll likely try the baked in Rails feature though.