Skip to content

ActionMailer fails on rails 6.1.6.1 and ruby 3.2 #46883

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

Closed
javiyu opened this issue Jan 4, 2023 · 10 comments
Closed

ActionMailer fails on rails 6.1.6.1 and ruby 3.2 #46883

javiyu opened this issue Jan 4, 2023 · 10 comments

Comments

@javiyu
Copy link
Contributor

javiyu commented Jan 4, 2023

Steps to reproduce

When I try to execute a mailer that accepts kwargs

SomeMailer.notify(user: user).deliver_now

I get the following error.

ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: user)

The same code was working on ruby 3.1. I have debugged the code and if I monkey patch the app with the following snippet the error goes away.

ActionMailer::Base.class_eval do
  ruby2_keywords :process
end

ActionView::Rendering.class_eval do
  def process(...)
    old_config, I18n.config = I18n.config, ActionView::I18nProxy.new(I18n.config, lookup_context)
    super
  ensure
    I18n.config = old_config
  end
end

ActionMailer::Rescuable.class_eval do
  def process(...)
    handle_exceptions do
      super
    end
  end
end

AbstractController::Callbacks.class_eval do
  def process_action(...)
    run_callbacks(:process_action) do
      super
    end
  end
end

AbstractController::Base.class_eval do
  ruby2_keywords(:process)

  def process_action(...)
    send_action(...)
  end
end

I don't have a lot of time right now to create the tests scenarios, if adding just the patch is enough I can open a PR myself.

Expected behavior

The call should succeed.

Actual behavior

The call fails and raises the following error:

ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: user)

System configuration

Rails version: 6.1.6.1
Ruby version: 3.2.0

@skipkayhil
Copy link
Member

Hey @javiyu, thanks for opening an issue! Can you post the whole stacktrace for the error you are seeing?

@skipkayhil skipkayhil added actionmailer more-information-needed When reporter needs to provide more information labels Jan 4, 2023
@javiyu
Copy link
Contributor Author

javiyu commented Jan 4, 2023

Hey @javiyu, thanks for opening an issue! Can you post the whole stacktrace for the error you are seeing?

ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: user)
      /home/circleci/<REDACTED>/some_mailer.rb:8:in `notify'
      /home/circleci/bundle/ruby/3.2.0/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:228:in `process_action'
      /home/circleci/bundle/ruby/3.2.0/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
      /home/circleci/bundle/ruby/3.2.0/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:165:in `process'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/rescuable.rb:25:in `block in process'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/rescuable.rb:24:in `process'
      /home/circleci/bundle/ruby/3.2.0/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:39:in `process'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/base.rb:615:in `block in process'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/base.rb:614:in `process'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/message_delivery.rb:128:in `block in processed_mailer'
      <internal:kernel>:90:in `tap'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/message_delivery.rb:127:in `processed_mailer'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/message_delivery.rb:118:in `deliver_now'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/mail_delivery_job.rb:23:in `perform'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:48:in `block in perform_now'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/contrib/active_job/log_injection.rb:15:in `block (2 levels) in included'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/i18n-1.12.0/lib/i18n.rb:322:in `with_locale'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:21:in `block in instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:31:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:14:in `block (2 levels) in <module:Instrumentation>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:24:in `tag_logger'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:47:in `perform_now'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:25:in `block in execute'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/railtie.rb:47:in `block (4 levels) in <class:Railtie>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/reloader.rb:72:in `block in wrap'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/reloader.rb:71:in `wrap'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/railtie.rb:46:in `block (3 levels) in <class:Railtie>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:23:in `execute'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/queue_adapters/test_adapter.rb:50:in `perform_or_enqueue'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/queue_adapters/test_adapter.rb:30:in `enqueue'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/enqueuing.rb:59:in `block in enqueue'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:21:in `block in instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:31:in `instrument'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:9:in `block (2 levels) in <module:Instrumentation>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:24:in `tag_logger'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:14:in `block (2 levels) in <module:Logging>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/enqueuing.rb:55:in `enqueue'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/configured_job.rb:16:in `perform_later'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/message_delivery.rb:146:in `enqueue_delivery'
      /home/circleci/bundle/ruby/3.2.0/gems/actionmailer-6.1.6.1/lib/action_mailer/message_delivery.rb:99:in `deliver_later'
      /home/circleci/syft/components/agency_portal/app/modules/agency_portal/internal/send_worker_job_card_email.rb:14:in `send_email_async'
      /home/circleci/syft/components/agency_portal/app/modules/agency_portal/internal/send_email_base.rb:28:in `send_email'
      /home/circleci/syft/components/agency_portal/app/modules/agency_portal/internal/send_email_base.rb:15:in `process'
      /home/circleci/syft/app/lib/operation.rb:49:in `block (2 levels) in call'
      /home/circleci/syft/app/modules/helpers/auditing.rb:7:in `with_audited_actor'
      /home/circleci/syft/app/lib/operation.rb:48:in `block in call'
      /home/circleci/syft/app/lib/operation.rb:43:in `catch'
      /home/circleci/syft/app/lib/operation.rb:43:in `call'
      /home/circleci/syft/app/lib/operation.rb:29:in `call'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:10:in `block (2 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:343:in `block (2 levels) in let'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `block (3 levels) in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `fetch'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `block (2 levels) in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-support-3.11.1/lib/rspec/support/reentrant_mutex.rb:23:in `synchronize'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:178:in `block in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:177:in `fetch'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:177:in `fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:343:in `block in let'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:102:in `block (5 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/testing/assertions.rb:34:in `assert_nothing_raised'
      /home/circleci/bundle/ruby/3.2.0/gems/activejob-6.1.6.1/lib/active_job/test_helper.rb:594:in `perform_enqueued_jobs'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:102:in `block (4 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:343:in `block (2 levels) in let'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `block (3 levels) in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `fetch'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:179:in `block (2 levels) in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-support-3.11.1/lib/rspec/support/reentrant_mutex.rb:23:in `synchronize'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:178:in `block in fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:177:in `fetch'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:177:in `fetch_or_store'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/memoized_helpers.rb:343:in `block in let'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:105:in `block (4 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:365:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:529:in `block in run_owned_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:528:in `each'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:528:in `run_owned_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:615:in `block in run_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:614:in `reverse_each'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:614:in `run_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:484:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:505:in `run_before_example'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:261:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:19:in `block (3 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/timecop-0.9.6/lib/timecop/timecop.rb:201:in `travel'
      /home/circleci/bundle/ruby/3.2.0/gems/timecop-0.9.6/lib/timecop/timecop.rb:131:in `send_travel'
      /home/circleci/bundle/ruby/3.2.0/gems/timecop-0.9.6/lib/timecop/timecop.rb:52:in `freeze'
      /home/circleci/syft/components/agency_portal/spec/modules/agency_portal/internal/send_worker_job_card_email_spec.rb:19:in `block (2 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-rails-6.0.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
      /home/circleci/bundle/ruby/3.2.0/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
      /home/circleci/bundle/ruby/3.2.0/gems/knapsack_pro-3.6.0/lib/knapsack_pro/adapters/rspec_adapter.rb:68:in `block (2 levels) in bind_time_tracker'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:259:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/ci/contrib/rspec/example.rb:45:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/ci/test.rb:25:in `block in trace'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/trace_operation.rb:191:in `block in measure'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/span_operation.rb:151:in `measure'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/trace_operation.rb:191:in `measure'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/tracer.rb:380:in `start_span'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/tracer.rb:162:in `block in trace'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/context.rb:45:in `activate!'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing/tracer.rb:161:in `trace'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/tracing.rb:18:in `trace'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/ci/test.rb:23:in `trace'
      /home/circleci/bundle/ruby/3.2.0/gems/ddtrace-1.5.2/lib/datadog/ci/contrib/rspec/example.rb:31:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `map'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `run_examples'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:607:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `map'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `map'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `map'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `map'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/configuration.rb:2068:in `with_suite_hooks'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/reporter.rb:74:in `report'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:115:in `run_specs'
      /home/circleci/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:89:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/knapsack_pro-3.6.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:93:in `run_tests'
      /home/circleci/bundle/ruby/3.2.0/gems/knapsack_pro-3.6.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:40:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/knapsack_pro-3.6.0/lib/tasks/queue/rspec.rake:6:in `block (3 levels) in <main>'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:279:in `block in execute'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:279:in `each'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:279:in `execute'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
      /home/circleci/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
      /home/circleci/bundle/ruby/3.2.0/bin/rake:25:in `load'
      /home/circleci/bundle/ruby/3.2.0/bin/rake:25:in `<top (required)>'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:58:in `load'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:58:in `kernel_load'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:23:in `run'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli.rb:483:in `exec'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli.rb:31:in `dispatch'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/cli.rb:25:in `start'
      /home/circleci/.rubygems/gems/bundler-2.3.18/exe/bundle:48:in `block in <top (required)>'
      /home/circleci/.rubygems/gems/bundler-2.3.18/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
      /home/circleci/.rubygems/gems/bundler-2.3.18/exe/bundle:36:in `<top (required)>'
      /home/circleci/.rubygems/bin/bundle:25:in `load'
      /home/circleci/.rubygems/bin/bundle:25:in `<main>'

@rails-bot rails-bot bot removed the more-information-needed When reporter needs to provide more information label Jan 4, 2023
@rafaelfranca
Copy link
Member

Thank you for the issue. Rails 6.1 only receives security bug fixes. At the moment it doesn't work with Ruby 3.2. We are open to a PR that make the test pass and add support to Ruby 3.2 for the 6-1-stable branch, but we are not going to do the work.

@rafaelfranca rafaelfranca closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
@mkamensky
Copy link

Thank you for the issue. Rails 6.1 only receives security bug fixes. At the moment it doesn't work with Ruby 3.2. We are open to a PR that make the test pass and add support to Ruby 3.2 for the 6-1-stable branch, but we are not going to do the work.

The same happens to me in Rails 7.0.4

@thekendalmiller
Copy link

thekendalmiller commented Jan 4, 2023

I believe the mail gem changing it's argument is fixed in main at this point, but you can also resolve it by using the previous mail gem
In Gemfile gem 'mail', '~> 2.7.1' # 2.8.0 isn't compatible yet

Unsure what other issues you'll hit with ruby 3.2

@eileencodes
Copy link
Member

eileencodes commented Jan 5, 2023

The same happens to me in Rails 7.0.4

Are you sure? #44850 was backported to 7-0-stable in April the release of 7.0.4 was in September. I double checked locally and the v7.0.4 tag contains that commit.

Having a test included or a reproduction would help out a lot here to determine the right fix.

@javiyu
Copy link
Contributor Author

javiyu commented Jan 5, 2023

The same happens to me in Rails 7.0.4

Does it happen only when running in a test? rspec-mocks requires some fixes related to argument forwarding as well.

@mkamensky
Copy link

The same happens to me in Rails 7.0.4

Are you sure? #44850 was backported to 7-0-stable in April the release of 7.0.4 was in September. I double checked locally and the v7.0.4 tag contains that commit.

Having a test included or a reproduction would help out a lot here to determine the right fix.

This could be a different issue then. When I traced it, the problem was that I was using a double splat (**opts) in a mailer method, which was eventually dealt with in method_missing, which didn't treat it correctly (to my understanding)

@fiedl
Copy link

fiedl commented Feb 23, 2025

I still see this issue with actionmailer 7.2.0.beta1, mail 2.8.1, and ruby 3.3.2. I'm not sure why because it seems to have been resolved in rails in the meantime.

This is how I could resolve it, however:

class ApplicationMailer < ActionMailer::Base
  # ...

  # This patch accounts for the error
  #
  #   ArgumentError:
  #        wrong number of arguments (given 1, expected 0; required keywords:
  #
  # which has appeared with the switch to ruby 3.2.
  #
  # References:
  # - https://github.com/rails/rails/issues/46883
  # - https://github.com/rails/rails/issues/44846
  # - https://stackoverflow.com/q/76262079/2066546
  #
  def send_action(*args)
    if args.second.kind_of? Hash
      super(args.first, **args.second)
    else
      super
    end
  end
end

I realise that this issue considers rails 6. However, I found this issue in my search for a resolution. Feel free to delete my comment if it is inappropriate here. I would appreciate if you could redirect me to the correct issue then.

@thekendalmiller
Copy link

@fiedl I didn't test...but strongly suspect that this is fixed in the more recent versions of rails 7.2. Looks like you're on a beta. Update rails

https://github.com/rails/rails/tree/v7.2.2.1

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

No branches or pull requests

8 participants
@rafaelfranca @javiyu @eileencodes @fiedl @mkamensky @thekendalmiller @skipkayhil and others