Add troubleshooting section about CDN URL gotcha #3164
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new section to the troubleshooting document explaining a gotcha where the javascript asset file can be incorrectly linked when
config.asset_host
is configured with different URLs in different environments and assets are not re-compiled between those environments.As the new section explains this is common on Heroku where the user is encouraged to use their pipeline promote feature that does not re-compile assets between apps.
A common pattern is to use one app as a staging environment to evaluate builds. Upon acceptance, the staging app is “promoted” to the production environment. If
WEBPACKER_ASSET_HOST
is not set to an empty value in the staging application that application’s CDN URL will be compiled into the manifest.json file and reused in the production application.This issue can be tricky to detect as there might be no immediate error. The file probably still exists as it’s used by staging. When the staging environment later is re-deployed with new finger-printed assets the CDN will eventually remove the asset files that production is still dependent on.
All credit to @willcosgrove who provided this solution in #3005.