Rails assets precompile problems on heroku

It just broke, but heroku team is investigating it, so lets hope we’ll know what caused it soon. But there is some workaround, but your deployment process will become less convenient.

First precompile assets locally, by runnung

rake assets:precompile

I noticed that assets precompilation is allways in production env. You may assure that by running RAKE_ENV=production.

But that makes some problems on your local machine, since your app loads now both dynamic AND precompiled assets. You may notice that, when you have two ajax requests on one click running. What you need to do is adding this option to your environments/develomplent.rb:

  config.serve_static_assets = false

But be carefull if you use Thin server – it seems to ignore that one.

And please remember clear out web browser cache. And you should be good to go.

But you need to precompile assets manually and commit changes to repo before each deployment. That sucks, but the alternative is you siting there and waiting for miracle, and your work is not going forward. Which one sucks more for you?

Share Button

3 thoughts on “Rails assets precompile problems on heroku

  1. It turned out that there was some version issues on node.js. therubyracer gem added to Gemfile solved it all – gr8. And thanks to heroku team.

  2. What if you just removed plbiuc/assets from the master branch. Then do like you mentioned: create a heroku branch, pre-compile assets on that branch, commit those files to that branch, then push that branch to heroku master. Then you wouldn’t need to mess with the .gitignore and it should work seamlessly to merge changes from master into the heroku branch. Or am I missing something?, because I’m trying to do the same thing.

Leave a Reply

Your email address will not be published. Required fields are marked *