Reputation: 2222
I recently updated my application to Rails 7.1 and the development server seems to have stopped logging error backtraces.
Example of the logs from a broken page:
Started GET "/coffees-subscription-choices" for ::1 at 2023-12-06 16:07:08 -0600
ActiveRecord::SchemaMigration Load (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by GreatCoffeesController#index as HTML
Rendering layout layouts/about.html.erb
Rendering great_coffees/index.html.erb within layouts/about
Rendered great_coffees/index.html.erb within layouts/about (Duration: 31.9ms | Allocations: 7867)
Rendered layout layouts/about.html.erb (Duration: 32.1ms | Allocations: 8006)
Completed 500 Internal Server Error in 38ms (ActiveRecord: 12.5ms | Allocations: 11601)
No error message or backtrace.
I searched around a bit and applied these changes to config/initializers/new_framework_defaults_7_1.rb
, but to no effect :/
Rails.application.config.action_dispatch.show_exceptions = :all
Rails.application.config.action_dispatch.debug_exception_log_level = :error
Anyone know what I might be missing? Rails 7.0 logged the backtrace for errors as expected.
Upvotes: 9
Views: 1045
Reputation: 59
As for sentry-raven 3.1.2 gem which causes no backtrace:
Rails 7.1 adds a 3rd argument to #render_exception while Raven's overridden version of the same method only accepts 2 arguments.
for rails >= 7.1 should be like so
def render_exception(env_or_request, exception, _wrapper = nil)
begin
env = env_or_request.respond_to?(:env) ? env_or_request.env : env_or_request
Raven::Rack.capture_exception(exception, env)
rescue
end
super
end
Upvotes: 2
Reputation: 5898
For us, the culprit was the honeybadger
gem; for some reason we had it pinned in our Gemfile; you need at least version 5.1.0 as per the changelog
Upvotes: 2
Reputation: 2222
Thanks to the suggestions from Pascal, I was able to nail this down to outdated versions of rollbar
and web-console
.
Updating these 2 gems got my error reports in development back to expected!
Using web-console 4.2.1 (was 3.7.0)
Using rollbar 3.4.2 (was 3.3.1)
Upvotes: 11
Reputation: 101
We had the same problem and it happened that we used an old version of a gem (sentry-raven 3.1.2) that patched the DebugExceptions middleware. Because its render_exception
method signature changed with Rails 7.1, the patch itself caused an exception. Both the original and the additional exception are then not shown anywhere.
The solution for us was to patch the outdated gem, because we are not able to upgrade there.
Upvotes: 10