scoutapp / scout_apm_ruby

ScoutAPM Ruby Agent. Supports Rails, Sinatra, Grape, Rack, and many other frameworks

Home Page:https://scoutapm.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArgumentError in render after upgrading to 4.0.2

adrianpacala opened this issue · comments

Hey everyone.

We ran into an issue after upgrading to Scout APM 4.0.2. We're suspecting it has something to do with changes to signatures of rendering methods introduced in 2939679.

For example, this call to render which used to be working fine with 4.0.0:

render 'home', layout: 'home'

now raises an error:

ArgumentError - wrong number of arguments (given 3, expected 4):
  app/controllers/home_controller.rb:8:in `show'

We found similar issues in other gems:

The versions we're using are:

[1] pry(main)> RUBY_VERSION
=> "2.6.1"
[2] pry(main)> Rails.version
=> "6.0.3.4"
[3] pry(main)> ScoutApm::VERSION
=> "4.0.2"

scout_apm.yml below:

# This configuration file is used for Scout APM.
# Environment variables can also be used to configure Scout. See our help docs at http://help.apm.scoutapp.com#environment-variables for more information.
common: &defaults

  # key: Your Organization key for Scout APM. Found on the settings screen.
  # - Default: none
  key: <%= ENV['SCOUT_APM_KEY'] %>

  # log_level: Verboseness of logs.
  # - Default: 'info'
  # - Valid Options: debug, info, warn, error
  # log_level: debug

  # name: Application name in APM Web UI
  # - Default: the application names comes from the Rails or Sinatra class name
  name: xxx

  # monitor: Enable Scout APM or not
  # - Default: none
  # - Valid Options: true, false
  monitor: true

production:
  <<: *defaults

development:
  <<: *defaults
  monitor: false

test:
  <<: *defaults
  monitor: false

staging:
  <<: *defaults

I think I've got this fixed in 4.0.3, can you give it a try?

Ran into this same error. Updating to 4.0.3 fixed it.

Can confirm updating to 4.0.3 fixed this issue for us.

Hey guys, just wanted to let you know that removing thesupports_kwarg_delegation check breaks my Rails 4.0.4 (I know, I know ;) app with the same ArgumentError: wrong number of arguments (4 for 1..3) for render_template. I reverted back to Scout 4.0.2.

Is there a way to be on the lookout for this kind of issue before they hit an environment that has monitoring enabled?

As in, is it possible to somehow configure the Gem in a type of no-op set-up so that it loads the Scout code (and I could hit the render failure) without it trying to push results up to the server?

Scout APM v4.0.3 and v4.0.4 are causing the argument error reported by schneikai in our Rails 4.2.11 / Ruby 2.4.10 application. Attempts to render anything result in ArgumentError: wrong number of arguments (4 for 1..3) in render_template.

Reverting back to Scout APM 4.0.2 fixes the issue for us.

Any changes for this argument mismatch issue probably need to consider the ActionView version running in the app.

I ran into this bug today after I added the scout_apm gem to our Rails project. I resolved it by reverting from scout_apm 4.0.4 to 4.0.2 like many others here.

commented

Same issue here - reverted to 4.0.2.

I think I have this fixed for everybody in #413. Forwarding **kwargs at all wasn't necessary since both Rails 6 & older Rails 3,4,5 didn't use kwargs at all. By reverting that one spot we're slightly more vulnerable in the future to a breaking change in Rails (ie, rails 7 or 8 starts using kwargs there), but for the existing versions, this works.