sass-rails: Can't dump anonymous class

Hi! I’m playing around with Rails 4.2 beta, and on my development environment everything works fine. But when trying to deploy it to Heroku it throws the following warnings:

   Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   I, [2014-09-06T08:40:56.175939 #1419]  INFO -- : Writing /tmp/build_e9eb8553-5a26-45bb-9b07-4a29d52eebf5/public/assets/application-c38a0ad55f5bf7591155c6a2bde206ae.js
   Warning. Error encountered while saving cache 8c16b074fa857dd7330d237ba37aa77ede63da1b/application.css.sassc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache bc4c85f8e508d5e8d8306f180bfa2a3ff0b38670/normalize.cssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache 972b158d9548d695d24c06b6eebce83723bf8c73/_bourbon.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache ec194de8e45c18d895fbaea9472611503479082e/_prefixer.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache ec194de8e45c18d895fbaea9472611503479082e/_px-to-em.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache ec194de8e45c18d895fbaea9472611503479082e/_asset-pipeline.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache d6bf3497cb4eb5cc1717b3e31f3a48c562f51bf2/_convert-units.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache d6bf3497cb4eb5cc1717b3e31f3a48c562f51bf2/_gradient-positions-parser.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache d6bf3497cb4eb5cc1717b3e31f3a48c562f51bf2/_is-num.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   Warning. Error encountered while saving cache d6bf3497cb4eb5cc1717b3e31f3a48c562f51bf2/_linear-angle-parser.scssc: can't dump anonymous class #<Class:0x007fe009798f88>
   ....

I’m using sass-rails (5.0.0.beta1) as it is added to the Gemfile by default with Rails 4.2 beta. What can be going wrong?

Thanks in advance 😃

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@matthewd Thank you for replying.

I applied your advice, it’s now working! As you recommended I updated my gemfile to specify the sass gem to one more compatible with the Rails 3.2.x era:

gem 'rails', '3.2.21'

group :assets do
  gem 'sass', '~> 3.1.10'
  gem 'sass-rails',   '~> 3.2.6'
  gem 'coffee-rails', '~> 3.2.2'
  gem 'uglifier',     '>= 1.0.3'
end

With this changed Gemfile I ran bundle update 'sass' and it worked.

The can't dump anonymous class issue was resolved by specifying sass in the top of my Gemfile to a lower version compatible with Rails 3.2.x (sass (3.2.10)). The problem appears to be that even though sass-rails specifies 3.2.6, the sass gem automatically updates to a breaking version when rails 3.1.x is updated to rails 3.2.x (installing sass as sass (3.4.9)).

It might be a good idea in the Rails 3.2.x upgrade guides to specify gem 'sass', '~> 3.1.10' above gem 'sass-rails', '~> 3.2.6' to prevent this issue. Or alternatively, to specify that sass-rails load a gem version of sass lower than 3.2 to prevent this issue (sass-rails 3.2.6 currently only specifies needing sass versions higher than sass 3.1.0, appearing to allow sass-rails to include sass versions above 3.2.0 that breaks if upgrading to rails 3.2.x,).

The second option, of specifying sass versions properly within sass-rails is arguably better if possible, as it would make the next step of upgrading to rails 4.x less time consuming for people as they do not need to readdress the issue of sass versions in their gemfile.

PS: I understand the difficulties of maintaining open source projects in older versions – I am only relaying a sentiment that other developers give me about trusting Rails for future projects when they hear about these issues. Where I can I will make my own contributions where I can. I appreciate immensely the (unpaid) time maintainers such as yourself give to our issues.

It looks like it is really fixed now. I tested Rails 4.2.0.rc2 using the master branch of sass-rails and it works.

Looks like #292 did the job. 👍

went into production 3 years ago… to have this type of instability so soon is exactly what causes enterprise environments to get spooked away from Rails

Firstly: if the published Maintenance Policy is unacceptable to anyone, “enterprise environment” or otherwise, they should generally either 1) use something else, 2) pay someone to provide extended support, or 3) accept the risks, and wear the consequences, of deliberately running unsupported software. An implication of “we/others may use something else instead” fundamentally misapprehends the nature of a freely provided open source project.

Despite the above, I’ll go ahead and re-answer your question:

you probably want correspondingly-old versions of 💁 👉 ✨ sass ✨ 👈, sass-rails, sprockets, etc.

(subtle emphasis added)

I can’t give you an exact set of versions, but I would expect you to have better luck if you use the latest available point-release of the release series that was current when Rails 3.2.0 was released, instead of a week-old release of a series that didn’t exist until several months after Rails 3.2 became unsupported. Versions newer than that may work, or may not.

I’ll separately look into a suitable change to the upgrade guide… I’m not sure why we’d still [attempt to] document that at all.

Fixed on 4.0.5