Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgraded Rails 4 to Rail 5- now getting "NoMethodError: undefined method `original_exception' for #<ActionView::Template::Error:0x007f243ecd5d48>"

As described, I updated my Rails from v4 to v5.1.5 by updating the version in the Gemfile and running rails app:update. I'm getting the following error that crashes my server whenever I try to load a page:

    ActionView::Template::Error ($map2: (3rem 2.5rem 2rem 1.5rem 1.25rem 1rem 0.75rem) is not a map for `map-merge'):
    19:     src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
    20:     type="text/javascript">
    21:    </script>
    22:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    23:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    24:   <%= csrf_meta_tags %>
    25: </head>

app/assets/stylesheets/application.scss:18
app/views/layouts/application.html.erb:22:in `_app_views_layouts_application_html_erb__2123457921920629012_70201480953880'

NoMethodError: undefined method `original_exception' for #<ActionView::Template::Error:0x007fb21c9d6068>
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:16:in `block in render_exception_with_web_console'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `tap'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `render_exception_with_web_console'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:69:in `rescue in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:58:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:20:in `block in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:36:in `call_app'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `block in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `block in tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:26:in `tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/request_id.rb:25:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/executor.rb:12:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/static.rb:125:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/engine.rb:522:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/handler/webrick.rb:86:in `service'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
10.240.1.50 - - [06/Apr/2018:06:01:47 UTC] "GET / HTTP/1.1" 500 1477
- -> /
10.240.1.30 - - [06/Apr/2018:06:01:50 UTC] "GET /favicon.ico HTTP/1.1" 200 0
http://traid-emikaijuin.c9users.io/ -> /favicon.ico

I found a similar post which was to do with the default application.scss and application.js requiring directories which had not yet been created, but that does not apply in my case.

Here's the beginning of the application.html.erb:

<!DOCTYPE html>
<html>
<head>
  <title>Workspace</title>

  <link 
    href="https://fonts.googleapis.com/css?family=Raleway:200,400,700,800" 
    rel="stylesheet">
  <script
    src="https://code.jquery.com/jquery-3.3.1.js"
    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
    crossorigin="anonymous"></script>
  <script 
    defer 
    src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
   <script 
    async 
    defer 
    src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
    type="text/javascript">
   </script>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>

and my application.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */
@import "bulma";
@import "bootstrap";

// html {
//     background-color: rgba(107,186,167,0.3);
// }

// body{
// }
like image 706
emijune Avatar asked Apr 06 '18 06:04

emijune


2 Answers

Your web-console gem is out of date.

Try removing any version restrictions in Gemfile:

gem web-console

and then use

bundle update web-console

like image 62
Lennart Avatar answered Nov 07 '22 03:11

Lennart


original_exception was changed to cause in Rails 5.1. See commit here: https://github.com/rails/rails/commit/b9ba263e5aaa151808df058f5babfed016a1879f

Replace original_exception with cause to fix the issue.

like image 1
vanboom Avatar answered Nov 07 '22 03:11

vanboom