Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails development server not logging backtrace on 500 errors

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.

like image 307
gabeodess Avatar asked Apr 15 '26 22:04

gabeodess


2 Answers

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)
like image 124
gabeodess Avatar answered Apr 17 '26 12:04

gabeodess


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.

like image 20
Pascal Zumkehr Avatar answered Apr 17 '26 13:04

Pascal Zumkehr