refinerycms-page-images icon indicating copy to clipboard operation
refinerycms-page-images copied to clipboard

Heroku pre-compiling assets fails after Heroku deprecated user-env-compile

Open LoganDSPrice opened this issue 7 years ago • 5 comments

In the Deploying to Heroku section, the instructions state to run heroku labs:enable user-env-compile -a myapp in order to properly precompile assets. Heroku has since deprecated that.

I've found reference to the Buildpack API, but I don't understand it and how it relates to the precompiling issues with refinerycms-page-images.

I'm getting:

remote: Bundle completed (37.20s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v6.10.0-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: PageImages is unable to find model class: Refinery::Project remote: PageImages is unable to find model class: Refinery::TeamMember remote: I, [2017-06-19T22:48:46.443418 #1616] INFO -- : Writing /tmp/build_90b279a9215d270edbde0c7b129f78ce/public/assets/font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot remote: I, [2017-06-19T22:48:46.444823 #1616] INFO -- : Writing /tmp/build_90b279a9215d270edbde0c7b129f78ce/public/assets/font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot.gz

... and so on.

It seems like there has to be a new method for deploying to Heroku while using refinerycms-page-images.

LoganDSPrice avatar Jun 19 '17 23:06 LoganDSPrice

I use Refinerycms-page-images on Heroku with no problems.

I precompile my assets on my dev systems using

RAILS_ENV=production rake assets:precompile

then incorporate changed assets into the git repo using

git status
git add /git rm / etc
git commit -m 'precompiled assets'
git push heroku master

anitagraham avatar Jun 20 '17 03:06 anitagraham

Thanks for the reply!

I ran RAILS_ENV=production rake assets:precompile and I'm still getting the same error:

RAILS_ENV=production rake assets:precompile PageImages is unable to find model class: Refinery::Project PageImages is unable to find model class: Refinery::TeamMember

Any idea how that would be fixed?

LoganDSPrice avatar Jun 20 '17 18:06 LoganDSPrice

More info:

When I run rake assets:precompile, precompiling finishes without error. When I then try to push to heroku, I still get the error in my above comment.

I don't understand why PageImages is unable to find the models.

I did follow this guide to be able to use image collections for my models. Is there a chance that is messing things up?

I found elsewhere that putting config.assets.initialize_on_precompile = false in the application.rb file could prevent the precompile issue when pushing to Heroku. Any ideas on that?

LoganDSPrice avatar Jun 20 '17 19:06 LoganDSPrice

If precompile in production isn't completing, then heroku is trying to do the precompile and getting the same error.

Try changing your gemfile so that the gem(s) with Project and TeamMember are called before refinerycms-page-images. You have to do this with Refinerycms-blog and this sounds like a similar problem.

gem 'refinerycms-blog',           git: 'https://github.com/refinery/refinerycms-blog', branch: 'master'
# blog must come before page-images
gem 'refinerycms-page-images',     git: 'https://github.com/refinery/refinerycms-page-images',    branch: 'master'

anitagraham avatar Jun 21 '17 05:06 anitagraham

Is your issue fixed @LoganDSPrice ?

bricesanchez avatar Jan 26 '18 13:01 bricesanchez