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

Makara latest + ruby 3: NoMethodError: undefined method 'provide' for nil:NilClass #383

Open
cr0mbly opened this issue Nov 9, 2023 · 4 comments

Comments

@cr0mbly
Copy link

cr0mbly commented Nov 9, 2023

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 cr0mbly changed the title Makara latest + ruby 3: NoMethodError: undefined method provide' for nil:NilClass` Makara latest + ruby 3: NoMethodError: undefined method 'provide' for nil:NilClass Nov 9, 2023
@wjessop
Copy link

wjessop commented Jan 11, 2024

@cr0mbly Did you solve this? Hitting the same error.

@cr0mbly
Copy link
Author

cr0mbly commented Apr 4, 2024

@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.

@lloydwatkin
Copy link

lloydwatkin commented Apr 29, 2024

@wjessop we got hit with the same, and Makara seems broken with ActiveRecord7.1+, so we created @olioex/janus-ar to solve the problem

@wjessop
Copy link

wjessop commented Apr 29, 2024

Thanks @lloydwatkin, I'll check it out. I'll likely try the baked in Rails feature though.

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

No branches or pull requests

3 participants