I'm having a really bad day at this: #rails-noob #githubsucks #herokufail #abouttosmashmylaptop. Ok, I feel better.
I have created an app using Rails 3.2.12/ruby 1.9.3. It's working locally - no issues at all - and I've saved locally with github, although I'm having some github.com issues (see this question Git duplication - receive pack not found). So I tried to deploy to Heroku locally, i.e. not via github.com. It seems to work - there are no obvious issues, but then when I try to actually open the application (i.e. browse the website) I get the infamous "We're sorry, but something went wrong". Here's what I've tried so far:
- Heroku status: no known issues either in production or development
- Heroku run rake db:migrate
- Heroku pg:reset (followed by #2)
- Checking "gem 'pg'" is in the gemfile for production (although I still have sqlite3 for development)
- I switched ‘config.assets.compile = false’ to ‘true’ in /config/production.rb
- I’m using Rails 3.2.1, so I've checked I’m on the cedar stack
- I've also enabled assets in my “application.rb” file – ‘config.assets.enabled = true”</li>
I’ve checked Heroku logs etc. multiple times, and there’s no issues – everything looks fine - except that there's a 500-error. From what I've read it seems there might have previously (pre-Rails 4.0) been a Heroku issue driving these errors, but I can't seem to find reference to either a. it being fixed, or b. how to fix it.
Suggestions?
UPDATE: As per culix's suggestion, I tried to turn on the log level although but it doesn't seem to change the log output (time codes removed).
app[web.1]: Started GET "/" for 124.148.153.24 at 2013-08-11 07:30:40 +0000
app[web.1]: Processing by StaticPagesController#splash as HTML
app[web.1]: Rendered static_pages/splash.html.erb within layouts/application (2.6ms)
heroku[router]: at=info method=GET path=/ host=genericappname.herokuapp.com fwd="124.148.153.24" dyno=web.1 connect=2ms service=1470ms status=500 bytes=643
app[web.1]: Completed 500 Internal Server Error in 1459ms app[web.1]: ActionView::Template::Error (undefined method `[]' for nil:NilClass
app[web.1]: (in /app/app/assets/stylesheets/application.css)):
app[web.1]: 2:
app[web.1]: 3:
app[web.1]: 4: <%= full_title(yield(:title)) %>
app[web.1]: 5: <%= stylesheet_link_tag "application", :media => "all" %>
app[web.1]: 6: <%= javascript_include_tag "application" %>
app[web.1]: 7: <%= csrf_meta_tags %>
app[web.1]: 8: <%= render 'layouts/shim' %>
app[web.1]: app/v
However, when I was pushing changes back to Heroku I did pick up two issues:
- I hadn't specifically declared my ruby version in the gemfile (now done); and,
- an issue with assets not precompiling - "undefined method '[]' for nil:NilClass". I tried manually compiling assets from the command line as per Heroku's advice (https://devcenter.heroku.com/articles/rails-asset-pipeline) but no joy - same nil:NilClass error.
Related, or an entirely new problem?
UPDATE 2: In response to some comments/questions:
- culix, I have tried the DevCenter (see #2 in update 1).
- Log level is set to :debug, but maybe I've done it wrong? I'm learning as I go - how can I get log info from production when it won't load?
- In regards to the NilClass the app is working in development, so it has to be something that needs to be loaded in production, e.g. assets or database? I’ve updated the error generated above – I may have cut off some crucial information previously. I looks like it’s in the application.css and some other posts seem to suggest that bootstrap in Rails 3.2 can be an issue for production so any suggestions welcome?
- I tried both slug and local compilation - neither works.
I’m struggling with lack of Heroku error info to guide me, so directions in that regard welcome also.
UPDATE 3: After running 'run rake assets:precompile' I got a whole heap of Deprecation warnings, along the lines of:
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 into your gemfile.
But my vendor/plugins folder is empty?
I have also run 'rake assets:precompile --trace' (I learnt a new command!) and got the following around where the error occurs:
** Execute assets:precompile:primary
rake aborted!
/app/app/assets/stylesheets/application.css has already been required
/app/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:267:in `circular_call_protection'