Skip to content

Rails 5 (beta 1 & beta 2) development mode broken #456

@siegy22

Description

@siegy22

undefined method [] for #<ActionDispatch::Request:0x007ff8a811b158>


According to this commit, the interface of the render_exception method changed.
Now theres no longer the env passed, instead the request is passed.
Which means to fix this, the easiest way would be, to change the Raven::Rack.capture_type (https://github.com/getsentry/raven-ruby/blob/master/lib/raven/integrations/rack.rb#L24-L33) to the following:

    def self.capture_type(exception, request, options = {})
      env = request.env
      if env['raven.requested_at']
        options[:time_spent] = Time.now - env['raven.requested_at']
      end
      Raven.capture_type(exception, options) do |evt|
        evt.interface :http do |int|
          int.from_rack(env)
        end
      end
    end

(more an ugly hotfix than a real fix..)

Another point:
The Rails Middleware method should have a begin/rescue block or maybe a ensure to make it easier to find the exceptions. In my case, it was very hard because rails rescued the fail made by sentry with a 500 html site, plus there was no log at all..
https://github.com/getsentry/raven-ruby/blob/master/lib/raven/integrations/rails/middleware/debug_exceptions_catcher.rb#L9-L11


To temporarily fix this, I added a configuration inside the Raven.configure block:

Raven.configure do |config|
  ....
  config.catch_debugged_exceptions = false
  ....
end

/cc @senny

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions