0
votes

I have a Rails app which has a photo uploading feature. Previously I was using CarrierWave_Direct to upload directly to S3 (based on Railscast 383). In order to optimize the app, I went ahead and switched to Cloudinary.

The app currently works locally just fine with Cloudinary. However when I pushed to heroku the app crashes with the server log error:

ActionView::Template::Error (Invalid CSS after "  font-family: ": expected expression (e.g. 1px, bold), was "@altFontFamily;"
2013-09-04T05:16:29.148898+00:00 app[web.1]:   (in /app/app/assets/stylesheets/application.css)):
2013-09-04T05:16:29.148898+00:00 app[web.1]:     12:       <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
2013-09-04T05:16:29.148898+00:00 app[web.1]:     13:     <![endif]-->
2013-09-04T05:16:29.148898+00:00 app[web.1]:     14: 
2013-09-04T05:16:29.148898+00:00 app[web.1]:     15:     <%= stylesheet_link_tag "application", :media => "all" %>
2013-09-04T05:16:29.148898+00:00 app[web.1]:     16: 
2013-09-04T05:16:29.148898+00:00 app[web.1]:     17:     <!-- For third-generation iPad with high-resolution Retina display: -->
2013-09-04T05:16:29.148898+00:00 app[web.1]:     18:     <!-- Size should be 144 x 144 pixels -->
2013-09-04T05:16:29.149145+00:00 app[web.1]:   app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb__164934612574999860_69925614481940'
2013-09-04T05:16:29.149145+00:00 app[web.1]: 
2013-09-04T05:16:29.149145+00:00 app[web.1]: 
2013-09-04T05:16:29.149499+00:00 app[web.1]: Processing by LandingController#landing as HTML
2013-09-04T05:16:29.149499+00:00 app[web.1]:   Rendered landing/landing.html.erb within layouts/application (58.3ms)
2013-09-04T05:16:29.149499+00:00 app[web.1]: Completed 500 Internal Server Error in 158ms

I reverted back to a previous commit previous to adding Cloudinary (when the app worked, and have isolated the moment when the app starts breaking to when I add the Cloudinary Gem. Even though the error references a css error the app only breaks when I add the Cloudinary Gem.

In the process of trying to figure this out I discovered that when I run heroku run rake I get the error.

rake aborted! undefined method `[]' for nil:NilClass

I suspect this is the issue, however the app only breaks when adding the Cloudinary Gem, even though if I run 'heroku run rake' BEFORE adding the gem, I get the same error, yet the app still functions.

Here is what I got when I ran heroku run rake --trace

$ heroku run rake --trace
Running `rake --trace` attached to terminal... up, run.1893
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
** Invoke default (first_time)
** Invoke spec (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:test:purge
rake aborted!
undefined method `[]' for nil:NilClass
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:511:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:544:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => db:test:load => db:test:purge

Any suggestions are well appreciated.

EDIT Adding application.css file.

/*
 * 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require bootstrap_and_overrides
 *= require jquery.ui.datepicker
 *= require_tree .
 *= require jquery.ui.all
 */

 input[type=number]::-webkit-inner-spin-button,
 input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
 }
 .form-signin {
        max-width: 300px;
        padding: 19px 29px 29px;
        margin: 0 auto 20px;
        background-color: #fff;
        opacity: .9;
        border: 5px solid #0367b0;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
                text-align: center;
      }
h2.form-signin {
  font-family: @altFontFamily;
}
.landing {
  background: url('baseball_dirt.jpg') no-repeat scroll center top transparent;
  height: 100%;
  padding:120px 0;
}
.signup {
  background: url('homeplate_line.jpg') no-repeat scroll center top transparent;
  height: 100%;
  padding:120px 0;
}
.signip .well {
  opacity: .85;
}
.signin {
  background: url('baseball_dirt.jpg') no-repeat scroll center top transparent;
  height: 100%;
  padding:120px 0;
}
.signin .well {
  opacity: .85;
}
1
Looks like if I comment out ` <%#= stylesheet_link_tag "application", :media => "all" %>` the app will function properly on heroku, (aside from there being no styling). - lando2319
Can you attach your application.css file? It appears something there is causing the error - Tal Lev-Ami
Just EDITED the post. Any insights are MUCH appreciated. - lando2319
Even if I comment out the entire application.css file I still get the error. - lando2319
The error you reported is for a line in your application.css, what is the error you are getting when the file is commented out? BTW @altFontFamily is LESS syntax. Make sure the file is called application.css.less - Tal Lev-Ami

1 Answers

0
votes

I finally tracked down this error, It was the invalid css.

  font-family: 'Myriad W01 Lt It';