16

My website used to be working and Heroku precompiled the assets and everything. Now, seemingly out of nowhere, I started to get rake aborted! stack level too deep on deploy.

Deleting the line *= require_tree . from my application.css file seems to fix thestack level too deep but then I get this:

Running: rake assets:precompile
(in /tmp/build_b8o2t4k8frce)
/usr/local/bin/ruby /tmp/build_b8o2t4k8frce/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
(in /tmp/build_b8o2t4k8frce)

All my links to images are broken (I'm using image-url() in my css file). What could be the problem and how do I fix it?

I'm using cedar stack and this is my gemfile:

gem 'rails', '3.1.0'
gem 'rake', '0.8.7'
gem 'devise'

group :production do
  gem 'pg'
  gem 'thin'
end

group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

And here are the versions used by heroku:

Using rake (0.8.7)
Using rails (3.1.0)
Using sass (3.1.15)
Using sass-rails (3.1.6)

Here's my application.rb file

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module App
  class Application < Rails::Application

    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets.
    config.assets.version = '1.0'
  end
end

And here's my production.rb file

# Full error reports are disabled and caching is turned on
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

# Enable Rails's static asset server (Apache or nginx will not need this)
config.serve_static_assets = true

# Set expire header of 30 days for static files
config.static_cache_control = "public, max-age=2592000"

# Allow JavaScript and CSS compression
config.assets.compress = true

# Compress JavaScript by removing whitespace, shortening variable names, ...
config.assets.js_compressor = :uglifier

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

# Generate digests for assets URLs
config.assets.digest = true
Ashitaka
  • 19,028
  • 6
  • 54
  • 69

3 Answers3

34

I had a similar problem and found the answer here: https://github.com/rails/sass-rails/issues/78. Basically, downgrade to sass-rails v3.1.4. Hope this helps

ChrisBurgess
  • 356
  • 2
  • 3
  • 5
    Wow, that's it! That fixed it! The thing is, I'm a newbie and I thought that this line `gem 'sass-rails', "~> 3.1.0"` meant that my gem version was locked but apparently that squiggly hashrocket (or whatever it's name) let's the gem be updated. And maybe that's what happened, maybe internally Heroku changed something and all of a sudden my app stopped working. Really strange stuff that made me lose a whole day for nothing. For anybody that might end up here, the solution was to change that line to `gem 'sass-rails', "3.1.4"`. – Ashitaka Mar 21 '12 at 13:26
  • Thanks - BIG help - same issue, out of nowhere. That was the last thing I needed to see today was push to heroku failing. – jpw Mar 21 '12 at 22:14
1

You shouldn't had to delete this *= require tree . from application.css, coz it loads all you styles. just add it, and configure your config/production.rb file like this:

config.assets.precompile = %w{application.js}

and run RAILS_ENV=production rake assets:precompile

EDIT try to use this config:

config.assets.digest  = true
Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53
  • Yeah, this should work with `require_tree` but if I add it then I get the `rake aborted! stack level too deep`. I have no idea how this happened – Ashitaka Mar 20 '12 at 15:28
  • Sorry, I forgot to copy that specific line, I was already using digest. I found a workaround although I don't like it much – Ashitaka Mar 20 '12 at 17:47
0

Apparently sass stopped working and I ran out of patience so I decided not to use it anymore. Instead of doing this:

#theme.css.scss
background-image:image-url('image.png');

Now I am simply using an erb file:

#theme.css.erb
background-image:url(<%= asset_path 'image.png' %>);

I just lost a whole day because of this and I have no idea why because it was working fine just yesterday. If somebody knows what caused this and how I can use sass again, please comment.

Ashitaka
  • 19,028
  • 6
  • 54
  • 69
  • I noticed in some environments using sass I get errors if there is no space between the ':' and the value in my statements so instead of writing something like "background-image:image-url('image.png')"; write "background-image: image-url('image.png')" [NOTE THE SPACE AFTER THE ':'] – Tyrone Wilson Dec 21 '12 at 08:42