Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Arguements error when running migrations #32

Open
antarr opened this issue Oct 20, 2021 · 1 comment
Open

Arguements error when running migrations #32

antarr opened this issue Oct 20, 2021 · 1 comment

Comments

@antarr
Copy link

antarr commented Oct 20, 2021

I'm getting an arguments error when trying to connect after following the instructions in the README.

error

➜  wevote git:(master) ✗ bundle exec rake db:migrate
rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 0)
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-aurora-serverless-adapter-6.0.1/lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb:35:in `each_object'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-aurora-serverless-adapter-6.0.1/lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb:29:in `each'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/mysql2_adapter.rb:86:in `each_hash'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `each'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `map'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `columns'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:112:in `block in columns'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:111:in `fetch'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:111:in `columns'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:120:in `block in columns_hash'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:119:in `fetch'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/schema_cache.rb:119:in `columns_hash'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/model_schema.rb:553:in `load_schema!'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/attributes.rb:250:in `load_schema!'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/model_schema.rb:539:in `block in load_schema'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/model_schema.rb:536:in `synchronize'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/model_schema.rb:536:in `load_schema'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/model_schema.rb:392:in `columns_hash'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:1313:in `arel_column'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:1437:in `order_column'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:1406:in `block in preprocess_order_args'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:1403:in `map!'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:1403:in `preprocess_order_args'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:360:in `order!'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/query_methods.rb:355:in `order'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/querying.rb:22:in `order'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/schema_migration.rb:46:in `all_versions'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1282:in `load_migrated'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1278:in `migrated'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1314:in `ran?'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1260:in `block in runnable'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1260:in `reject'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1260:in `runnable'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1253:in `migrate'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1086:in `up'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1061:in `migrate'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/appsignal-3.0.9/lib/appsignal/integrations/rake.rb:7:in `execute'
/Users/antarr/code/github/wevote/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/Users/antarr/.rbenv/versions/3.0.1/bin/bundle:23:in `load'
/Users/antarr/.rbenv/versions/3.0.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Gemfile

gem 'activerecord-aurora-serverless-adapter'
gem 'mysql2-lambda'
# gem 'mysql2', '0.5.2'

config/database.yml

development:
  adapter: aurora_serverless
  # encoding: unicode
  database: development_one
  # pool: 50
  secret_arn: arn:aws:secretsmanager:us-east-2:0000000000:development/mysql-yOE8bY
  resource_arn: arn:aws:rds:us-east-2:0000000000:cluster:serverless-mysql

Snip20211019_1

@antarr
Copy link
Author

antarr commented Oct 20, 2021

Looks like it's a Ruby 3 change. I was able to get it working using a patch

config/initialiazer/result.rb

module ActiveRecord
  module ConnectionAdapters
    module AuroraServerless
      module Mysql2
        class Result


          private

          def each_object(kwargs)
            symbolize_keys = kwargs[:symbolize_keys]
            kwargs[:as] == :hash ? as_hash(symbolize_keys) : as_array
          end

          # ruby2_keywords(:each_object) if respond_to?(:ruby2_keywords, true)
        end
      end
    end
  end
end

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

No branches or pull requests

1 participant