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

NoMethodError: undefined method `add_child' for nil:NilClass

L33tH4x0r opened this issue · comments

Hey there!

I didn't see any resources on how to submit tickets, so let me know if I need to change anything.

Anyways, we're getting this error in our logs and I'm not sure where to start with the issue. I looked that the code inside the scout_apm gem and found that the NoMethodError is around the layers.

I tried downgrading the version from 4.0.0 but that didn't fix the issue.

This is the stacktrace we find

NoMethodError: undefined method `add_child' for nil:NilClass
  from scout_apm (2.6.9) lib/scout_apm/tracked_request.rb:120:in `stop_layer'
  from scout_apm (2.6.9) lib/scout_apm/instruments/action_controller_rails_3_rails4.rb:122:in `process_action'
  from activerecord (6.0.3.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
  from actionpack (6.0.3.4) lib/abstract_controller/base.rb:136:in `process'
  from actionview (6.0.3.4) lib/action_view/rendering.rb:39:in `process'
  from actionpack (6.0.3.4) lib/action_controller/metal/live.rb:252:in `block (2 levels) in process'
  from activesupport (6.0.3.4) lib/active_support/dependencies/interlock.rb:42:in `block in running'
  from activesupport (6.0.3.4) lib/active_support/concurrency/share_lock.rb:162:in `sharing'
  from activesupport (6.0.3.4) lib/active_support/dependencies/interlock.rb:41:in `running'
  from actionpack (6.0.3.4) lib/action_controller/metal/live.rb:244:in `block in process'
  from actionpack (6.0.3.4) lib/action_controller/metal/live.rb:294:in `block in new_controller_thread'

Here's info on our configuration:
Ruby: 2.7.2
Rails: 6.0.0
Scout Apm: 2.6.9

We use Heroku for our web hosting and we use the Scout Addon from there

scout_apm.yml

common: &defaults
  monitor: true
  name: <%= "(#{ENV['APP_ENVIRONMENT']&.titleize || 'ENV: ' + Rails.env.titleize})" %>
  enable_background_jobs: true
  timeline_traces: true

development:
  dev_trace: true
  monitor: true

test:
  monitor: false

production:
  <<: *defaults

Thank you for the report - we'll be taking a look as soon as possible.

Can you let us know at support@scoutapm.com the account you're setting this up on?

Fixed in Ruby agent 4.1.0