2

Configuration: Rails 4, HTML, CSS, on Heroku.

I have a Rails 4 app that has been in production for five months. Here's what's in my production.rb:

config.serve_static_assets = false

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Generate digests for assets URLs.
config.assets.digest = true
config.assets.enabled = true
config.assets.initialize_on_precompile = true
config.action_controller.asset_host = "//dynasfakeurl.cloudfront.net"

Whenever I push to production, I clean my assets using rake assets:clean, then precompile them using rake assets:precompile. This fingerprints my assets, and pushes it directly to my S3 static file bucket, which are served via cloudfront. I then push my app live to Heroku.

On the .html.erb homepage, I call my static files via Rails tags like this:

<%= image_tag "picture.png" %>
<%= stylesheet_link_tag "application" %>

Which render correctly using fingerprints. For example, the second one most recently generated this asset path: http://dynasfakeurl.cloudfront.net/assets/application-17892abdffc77f1fb1be125bab.css

Usually, this works great. However, I've had a problem, twice now, where after 12-16 hours of my last push, all of my asset paths spontaneously lose their fingerprints. For example, the stylesheet tag last generated this asset path: http://dynasfakeurl.cloudfront.net/stylesheets/application.css. Which doesn't exist. Thus, when I load the page, it fails to load the assets.

I've been stuck for the past few hours trying to debug this, but can't figure out why my asset paths would spontaneously, without me pushing anything, lose their fingerprints in production.

varun
  • 41
  • 3
  • Can you confirm you dyno is restarted in the meantime? Can you check the logs? Heroku definitely logs those events... – awendt May 22 '14 at 20:11
  • Yes, I restarted my dyno and it started operating correctly. This problem has occurred once again since my last post. – varun May 23 '14 at 20:37

0 Answers0