Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Aliased indexes failing on deploy #139

Closed
eileencodes opened this issue Sep 21, 2015 · 4 comments · Fixed by #145
Closed

Bug: Aliased indexes failing on deploy #139

eileencodes opened this issue Sep 21, 2015 · 4 comments · Fixed by #145
Labels
Milestone

Comments

@eileencodes
Copy link
Member

We recently upgraded to Rails 5 / Sprockets 4 and when I deployed had an issue with aliased indexes.

This happened on assets:precompile on our production deploy - for some reason deploys to our beta servers went fine. In fact the first deploy was fine, but a subsequent deploy of changes to CSS resulted in the error. Perhaps this is a caching issue in index_alias that was missed in b0b3c66?

The error we saw on deploy was: Sprockets::FileOutsidePaths: /u/apps/bc3/releases/20150921151240/app/assets/stylesheets/all/index.scss is no longer under a load path:

The structure we have in our js/stylesheets is

all/
all/index.scss
desktop/
desktop.scss (requires desktop/index)
desktop/index.scss
etc

To fix I had to add an all.scss file that required all/index. I think index aliasing may not be working as expected and that the error message could be clearer. Previously in sprockets 3 we didn't need to add an all.scss just to require the index file from the all folder.

cc/ @jeremy if you want to add any details.

@eileencodes eileencodes added this to the 4.0 milestone Sep 21, 2015
@rafaelfranca
Copy link
Member

Aliased Indexes have a lot of gotchas right now. See #40

@eileencodes
Copy link
Member Author

Ah ok thanks @rafaelfranca 👍

@jeremy
Copy link
Member

jeremy commented Sep 22, 2015

Added 9bffa47 to expose the underlying error: that it's actually the asset's index_alias that's an external path, not the asset.filename.

Index aliases aren't compressed/expanded like the other paths yet. They're set here and stored as an UnloadedAsset param.

cc @schneems

@schneems
Copy link
Member

The good news is that I think I got my email working again.

I was able to repro with the code from @eileencodes which was hugely helpful, thanks!

When I grep for absolute paths in the parent app's cache directory here's what i'm seeing:

$ grep -r -i "/User" tmp/cache/
# ...
tmp/cache//sprockets-4.0/55F/731/sprockets%2Fv4.0%2Ft84v-yw0MstganJX-PvWfe8mmllTNl6ajYOTmZH2axko:

o: ActiveSupport::Cache::Entry: @valueI"app/assets/stylesheets/all/index.scss?type=text/css&pipeline=self&index_alias=/Users/richardschneeman/Documents/projects/asset_cache_repo/asset_cache_test_parent/app/assets/stylesheets/all.scss&id=b87a98c889d2e0cedea5a9052d8d199475c974d6cb6c6417b7d15c1f1ffd22ae:ET:@created_atf1443124833.627042:@expires_in0

tmp/cache//sprockets-4.0/5A4/571/sprockets%2Fv4.0%2F8YQRhcxRVbsLngWROUH0Q5ycjf0smOmUpa__v5tyTloo:

o: ActiveSupport::Cache::Entry: @valueI"app/assets/stylesheets/all/index.scss?type=text/css&pipeline=self&index_alias=/Users/richardschneeman/Documents/projects/asset_cache_repo/asset_cache_test_parent/app/assets/stylesheets/all.scss&id=4d84f7f5ee2c8d3c5a2134fee4a0d505e4d2adfe0337815e9dad45e248a590e9:ET:@created_atf1443124802.368128:@expires_in0

So it looks like the absolute path is being appended to index_alias parameter in this pseudo URL scheme that we're using:

index_alias=/Users/richardschneeman/Documents/projects/asset_cache_repo/asset_cache_test_parent/app/assets/stylesheets/all.scss

This is good news because 3.x does not have this bug since it doesn't have the index_alias feature The reason why your patch works is because...I don't know, I haven't gotten that far yet. I'm going to prioritize looking into #141 since that affects an actively released versions (3.3 series). I'll come back to this issue after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants