Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Ruby 2.5.0 not show a stacktrace in Rails 5.1.4?

Here are two examples of the Rails server log for an error I encountered while only changing the Ruby version.

Ruby 2.4.2, Rails 5.1.4, Puma 3.11.0:

NoMethodError - undefined method `recent' for #<Event:0x00007f08507bf8b8>:
  path/to/show.html.haml:50:in `block in _path_to_show_html_haml___4224769623360811234_28796540'
  path/to/show.html.haml:30:in `_path_to_show_html_haml___4224769623360811234_28796540'

Ruby 2.5.0, Rails 5.1.4, Puma 3.11.0:

NoMethodError - undefined method `recent' for #<Event:0x00007f8ccc1b9508>:

What can I do to re-enable the stack trace in the Rails log? It doesn't look like there's a way to view which file/line number to look at.

To assist in investigating, I added this to my ApplicationController:

rescue_from Exception do |exception|
  byebug
  1+1
end

Ruby 2.4.2

(byebug) exception.backtrace
# A very large array of paths appears

Ruby 2.5.0

(byebug) exception.backtrace
nil
like image 499
ardavis Avatar asked Jan 18 '18 18:01

ardavis


Video Answer


1 Answers

The binding_of_caller gem in the Gemfile was out of date. I upgraded from 0.7.3 to 0.8.0 and the problem went away.

like image 197
ardavis Avatar answered Oct 15 '22 14:10

ardavis