rollbar / rollbar-gem

Exception tracking and logging from Ruby to Rollbar
https://docs.rollbar.com/docs/ruby
MIT License
441 stars 280 forks source link

Undefined method `params' for #<Hash> #1159

Open severin opened 5 days ago

severin commented 5 days ago

Hi there,

Looking at our NewRelic errors dashboard I notice quite a lot of exceptions that we don't see in Rollbar. Digging a bit deeper they are all raised from requests with non-existent paths that raise a RoutingError.

The relevant code is here: https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/middleware/rails/show_exceptions.rb#L10

I'm not too familiar with how rails integrates with rack but to me this code looks intuitively wrong: env is supposed to be a hash and so that line should probably be:

key = 'action_dispatch.show_detailed_exceptions'

if exception.is_a?(ActionController::RoutingError) && env[key]
  scope = ...

(The to_s call on key is also not necessary, since key is always a String)

Here is more context from NewRelic:

Screenshot 2024-07-03 at 10 27 25
linear[bot] commented 5 days ago

SDK-363 Undefined method `params' for #<Hash>