rails / sass-rails

Ruby on Rails stylesheet engine for Sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error encountered while saving cache ... can't dump hash with default proc

donmb1 opened this issue · comments

When deploying to heroku:

Error encountered while saving cache 59577ac82f2c1623e01184f55995a44284ee07e8/main.sassc: can't dump hash with default proc

Not really reproduceable but I read about this issue but with older versions of sass-rails.

gemfile.lock

sass (3.4.13)
sass-rails (5.0.3)
...railties (>= 4.0.0, < 5.0)
...sass (> 3.1)
...sprockets (>= 2.8, < 4.0)
...sprockets-rails (>= 2.0, < 4.0)
...tilt (
> 1.1)

Need more info?

Can you please provide a sample application that reproduces the error?

Ok, give me some time, will prepare it.

There you go: https://github.com/MartinB83/sass-test

just deployed on heroku stack https://stark-savannah-7379.herokuapp.com/
lmk if you need collaboration access

Any idea here?

Hi Martin, did you manage to solve this issue? I run into the same error just now.
Thanks!

    sass (3.4.14)
    sass-rails (5.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (~> 1.1)

Hi. No, unfortunately not and the error still persists. Luckily it does not have any impact yet. I just see it in the deployment log.

Martin, I've checked your test project with mine. The issue is related to the import of the google font:

@import url(http://fonts.googleapis.com/css?family=Hind:300,700)

If you remove that import you stop receiving the warning. I'll be checking the documentation to see if we are doing something wrong or if there is a reported bug related to it. I'll let you know if I have any luck.

ok thank you, will try to change it

Hi there I'm getting the same warning, any news about it? I can share my logs if needed.

I'm seeing the same thing, using active_skin (https://github.com/rstgroup/active_skin), on my Heroku project:

Warning. Error encountered while saving cache 9f4444befdf64451ebca1af556e4588e2120aeb4/active_skin.sassc: can't dump hash with default proc

Something about the Heroku environment triggering the error? Could be linked to @import of google fonts, as @enriquetuya suggested (active_skin does this too):

https://github.com/rstgroup/active_skin/blob/master/app/assets/stylesheets/active_skin.sass#L1

However, the import directive seems to be processed correctly.

I get the same error with activeskin file very often on my development environment. Unfortunately, because of that the error slows the rendering time of my css a lot.

After a bit of debugging, indeed, the problem lies in the @import directive of the google css file. Propably sass thinks its a .sass file and wants to download it or something, I don't know.

P.S. If someone has this issue atm with active_skin, u can do what I did:

  1. Copy the active_skin.sass file to your own app and remove the @import directive.
  2. Add the gfont using activeadmin initializer config: config.register_stylesheet '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700&subset=latin,latin-ext'

Hit this error today as well

Hit this error today as well

sass (3.4.22)
sass-rails (5.0.6)
  railties (>= 4.0.0, < 6)
  sass (~> 3.1)
  sprockets (>= 2.8, < 4.0)
  sprockets-rails (>= 2.0, < 4.0)
  tilt (>= 1.1, < 3)

The fonts still render in the browser but are excluded from the cache. It's not a huge performance hit per request, but it adds up.

We are not using active_skin or middleman, just plain old sass with google fonts:

We've tried the following variations with no joy:

@import url(https://fonts.googleapis.com/css?family=Montserrat:400,600,700|Open+Sans:400,600,700)
@import url(http://fonts.googleapis.com/css?family=Montserrat:400,600,700|Open+Sans:400,600,700)
@import url("http://fonts.googleapis.com/css?family=Montserrat:400,600,700|Open+Sans:400,600,700")
@import url(//fonts.googleapis.com/css?family=Montserrat:400,600,700|Open+Sans:400,600,700)

Commenting the @import line out stops the error but of course does not use the desired fonts.

UPDATE: downloading the .css file directly for https://fonts.googleapis.com/css?family=Montserrat:400,600,700|Open+Sans:400,600,700, saving it in a .css file and importing that instead does work around this error.

Further investigation reveals a similar issue to this:

  • A Sass::CacheStores::Base instance attempts (and fails) to call Marshal.dump on :
  • A Sass::Tree::RootNode instance which amongst its @children nodes has :
  • A Sass::Tree::CssImportNode instance which amongst its attributes has :
  • A :uri which is an instance of Sass::Script::Tree::Funcall which fails when trying to call Marshall.dump on it
  • The Sass::Script::Tree::Funcall instance has two attributes (args, options) both of which fail when trying to call Marshall.dump on them.

Like @srgpqt, I do not have enough knowledge of the sass internals to provide a fix yet. Maybe this problem doesn't belong here at all anyway but instead in the sass repo?

Update: Cross posted here: sass/sass#2110

Is there any solution to this yet, besides copying stuff around? I'm using active_skin, too, and I'd like to avoid copying the CSS into my project instead of simply using the gem...

Copying the google fonts CSS into my project was the fix for me. :(