Skip to content
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

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

Open
severin opened this issue Jul 3, 2024 · 3 comments
Open

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

severin opened this issue Jul 3, 2024 · 3 comments
Assignees
Labels

Comments

@severin
Copy link

severin commented Jul 3, 2024

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
Copy link

linear bot commented Jul 3, 2024

@zdavis-rollbar zdavis-rollbar added the Ruby label Jul 3, 2024 — with Linear
@waltjones
Copy link
Contributor

env is expected to be a Rack::Request instance, and the method to call [] directly on it has been removed.
https://github.com/rack/rack/blob/v3.0.8/lib/rack/request.rb#L608-L613

What is the situation that leads to having a hash here instead?

@severin
Copy link
Author

severin commented Aug 28, 2024

@waltjones I dug a bit into it: We are still using Rails 4.2, and the signature of the render_exception method has changed in Rails 5.0: rails/rails@9503e65

@waltjones waltjones self-assigned this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants