Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8820767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:41:24+00:00 2026-06-14T05:41:24+00:00

I used the gem asset_sync and aws to precompile my assets. rake assets:precompile works

  • 0

I used the gem asset_sync and aws to precompile my assets. rake assets:precompile works fine. After I pushed my app to heroku, and

heroku run rake db:migrate

I get the following error

“uninitialized constant AssetSync”

initializers/asset_sync.rb

AssetSync.configure do |config|
  config.fog_provider = 'AWS'
  config.aws_access_key_id = "..."
  config.aws_secret_access_key = "..."
  config.fog_directory = Rails.env + "-..."
  config.fog_region = 'eu-west-1'
end

config/production.rb

config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
config.assets.enabled = true 

After running run rake assets:precompile the first time, all my app/assets/images were moved to public/assets . I’ve deleted them from github and added public/assets/* to .gitignore. May this be the problem?

Edit: when running git push heroku master, it looks like they were precompiled

   Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   AssetSync: using /tmp/build_2ltvklj0gaxjp/config/initializers/asset_sync.rb
   AssetSync: using /tmp/build_2ltvklj0gaxjp/config/initializers/asset_sync.rb
   AssetSync: Syncing.
   Using: Directory Search of /tmp/build_2ltvklj0gaxjp/public/assets
   Uploading: assets/application-7e17d9f0ed9cb7ea50b750e2bfc7e28c.css.gz
   Uploading: assets/application-7e17d9f0ed9cb7ea50b750e2bfc7e28c.css
   AssetSync: Done.
   Asset precompilation completed (58.04s)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:41:25+00:00Added an answer on June 14, 2026 at 5:41 am

    Your initializer assumes that AssetSync is always defined, but this will not be the case if your Gemfile looks like:

    group :assets do
      gem 'asset_sync'
    end
    

    The asset_sync documentation recommends wrapping the initializer in:

    if defined?(AssetSync)
    ...
    end
    

    This is because Heroku runs production without the assets group of gems. Heroku precompiles your assets when you run a push — and if asset_sync is enabled, it will update S3 at that time — so when your application launches later, it no longer needs those gems. Thus, your asset_sync initializer needs to handle the situation where the gem is not loaded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before my app was on Heroku and used mysql gem. When I migrate that
I am building a facebook app using heroku. I used: gem install taps It
I'm not sure why, but whenever I run rake assets:precompile , application.js doesn't get
I'm trying to precompile assets: Gemfile: source 'https://rubygems.org' gem 'rails', '~> 3.2.1' # Bundle
I've successfully configured the ckeditor gem from https://github.com/galetahub/ckeditor on my Rails 3.1 app. My
I'm trying to set up a rails 3.2 app with the new compass-rails gem
I have installed bootstrap to my Rails 3.2 app this way (through Gemfile): gem
I used the twitter bootstrap library for my new simple rails app and used
I used the gem enumerated_attribute; however, the gem is not up to date and
Need help. Scripted in ruby (Not rails) and capybara-webkit gem used. Checked both on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.