Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use polyfill in Heroku-deployed Rails app #7

Closed
rdmurphy opened this issue Apr 14, 2022 · 5 comments
Closed

Unable to use polyfill in Heroku-deployed Rails app #7

rdmurphy opened this issue Apr 14, 2022 · 5 comments

Comments

@rdmurphy
Copy link

rdmurphy commented Apr 14, 2022

Hello!

Really excited about this library. We've been trying to get this in place within our Rails app and it seemingly is working fine locally and in CI — all our tests pass and Sprockets is happily using the Dart Sass. However when we attempt to deploy to Heroku we get this error during asset compiling:

LoadError: cannot load such file -- sass

I've found some existing mentions of that error that suggest it's a case of other gems trying to find sassc before it's ready, but I'm not sure why that's happening only on Heroku.

@rdmurphy
Copy link
Author

rdmurphy commented Apr 14, 2022

The full error:

 LoadError: cannot load such file -- sass
       /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27:in `require'
       /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/autoload/sass.rb:2:in `<main>'
       /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
       /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
       /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/sass_compressor.rb:46:in `initialize'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/sass_compressor.rb:26:in `new'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/sass_compressor.rb:26:in `instance'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/sass_compressor.rb:34:in `cache_key'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:102:in `processor_cache_key'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:49:in `processor_cache_key'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:111:in `block in processors_cache_keys'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:111:in `map'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:111:in `processors_cache_keys'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/processing.rb:165:in `resolve_processors_cache_key_uri'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets.rb:213:in `block in <module:Sprockets>'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/dependencies.rb:68:in `resolve_dependency'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:54:in `resolve_dependency'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:288:in `block in resolve_dependencies'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:288:in `map'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:288:in `resolve_dependencies'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:54:in `block in load'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:331:in `block in fetch_asset_from_dependency_cache'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:327:in `each'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:327:in `each_with_index'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:327:in `fetch_asset_from_dependency_cache'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:43:in `load'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:44:in `load'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:81:in `find_asset'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:88:in `find_all_linked_assets'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `each'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `to_a'
       /app/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `block in synchronize'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22:in `execute'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
       /app/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'```

@ntkme
Copy link
Member

ntkme commented Apr 14, 2022

It would be helpful if you can post your Gemfile. Also check this document and see if you can reproduce the problem locally: https://devcenter.heroku.com/articles/getting-started-with-rails6#runtime-dependencies-on-development-test-gems

@rdmurphy
Copy link
Author

rdmurphy commented Apr 14, 2022

Our Gemfile has some organization level pathing and such in it so it'll take me a moment to clean that up to share, but I did want to add a few new observations.

I was able to re-produce this locally so I don't believe it's actually a Heroku issue. I think what's happening here is that somewhere in our project we have something still trying to speak to libsass and it's successfully built in CI and on our local machines, so it finds it.

Another curious thing — we have this line in our production.rb:

config.assets.css_compressor = :sass

When I remove that, everything works. (Though the final CSS is of course not minified.)

@ntkme
Copy link
Member

ntkme commented Apr 14, 2022

I think you found the issue. Can you please try set it to :sassc?

config.assets.css_compressor = :sassc

@rdmurphy
Copy link
Author

That was it! Everything is working as expected locally and on Heroku. Thank you for your help! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants