Note that there are some explanatory texts on larger screens.

plurals
  1. POrails assets:precompile during slug for s3 error: Fog provider and directory can't be blank when env are set
    text
    copied!<p>I decided to serve rails assets via S3; heroku has great tutorials on how to do this. The site is now serving assets from my amazon bucket but I'm unsure why I had to manually run <code>heroku run rake assets:precompile</code> after a <code>git push heroku master</code> which runs a <code>rake assets:precompile</code>. </p> <p>After running the <code>git push heroku master</code> the assets where not in my bucket and the output for the precompile stuff was:</p> <pre><code>AssetSync: using default configuration from built-in initializer AssetSync: using default configuration from built-in initializer rake aborted! Fog provider can't be blank, Fog directory can't be blank /tmp/build_3vtwfg15g8ajx/vendor/bundle/ruby/1.9.1/gems/asset_sync-0.5.0/lib/asset_sync/asset_sync.rb:29:in `sync' /tmp/build_3vtwfg15g8ajx/vendor/bundle/ruby/1.9.1/gems/asset_sync-0.5.0/lib/tasks/asset_sync.rake:3:in `block in &lt;top (required)&gt;' Tasks: TOP =&gt; assets:precompile:nondigest (See full trace by running task with --trace) Precompiling assets failed, enabling runtime asset compilation Injecting rails31_enable_runtime_asset_compilation </code></pre> <p>I did set the fog provider and directory with: <code>heroku config:add FOG_DIRECTORY=XXX FOD_PROVIDER=AWS</code> and calling heroku config --app confirms this...so I don't get those errors.</p> <p>The assets didn't show up in my bucket so I ran: <code>heroku run rake assets:precompile</code> and everything worked with a warning:</p> <pre><code>AssetSync: using default configuration from built-in initializer AssetSync: Syncing. [WARNING] fog: the specified s3 bucket name(ss_assets) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/Bucket Restrictions.html </code></pre> <p>Will I always have to run the precompile task after and just be okay with the push failure? I'll check to see if the Warning of the directory name is causing the blank FOG errors on push</p> <p><strong>EDIT</strong> Again asset_sync doesn't appear to have ENV variables when called in the assets:precompile task of the heroku push. Running that task after push works but it 'annoying'.</p> <p>Still not working for me, latest attempt was (per <a href="https://github.com/rumblelabs/asset_sync/issues/41" rel="nofollow">asset_sync github project</a>):</p> <p>lib/tasks/asset_sync.rake.</p> <pre><code>Rake::Task['assets:precompile'].enhance do AssetSync.sync end Rake::Task["assets:precompile:nondigest"].enhance do AssetSync.sync end </code></pre> <p>I also attempted adding lines to my production.rb file such as:</p> <pre><code> config.asset_sync.aws_bucket = ENV['FOG_DIRECTORY'] config.asset_sync.fog_provider = ENV['FOG_PROVIDER'] </code></pre> <p>Didn't work for me either.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload