Open amiuhle opened 7 years ago
Ping, any ideas here, could there be a problem in this gem? Does shopify still use this gem? cc/ @bouk @TylerHorth
Weird. We do use this gem and we also use the manifest file even with sprockets 3 and we don't see this error in our application. Maybe something changed in sprockets or sprockets-rails that is including the manifest file in the bundle?
Yes, we still use this gem but I don't think we currently have an application that's being deployed with it and Sprockets 4
@amiuhle could you provide some more information on when this happens and what your application looks like? I assumed this would happen when precompiling the assets, but I can't reproduce it
The issue seems to be cache related. The problem only happens on the second push. I'm shooting in the dark here, but maybe shopify deploys with the same absolute path to the cache? Versus this app is running on Heroku and gets a different path on each deploy.
# sprockets/uri_utils.rb
def parse_asset_uri(uri)
scheme, _, path, query = split_file_uri(uri)
unless scheme == 'file'
raise URI::InvalidURIError, "expected file:// scheme: #{uri}"
end
return path, parse_uri_query_params(query)
end
Might be worth throwing a debugger in there and seeing what the uri is before the exception is raised. Might give us some hints towards what is actually going wrong here.
I just tried to reproduce this, but couldn't... I don't think it's worth putting any more effort into this, at least if someone else has the same problem, they'll find the workaround above.
If you agree, you can close this. Thanks for the feedback!
@TylerHorth uri is in the exception output alread. I think it's either false or nil or empty string:
raise URI::InvalidURIError, "expected file:// scheme: #{uri}"
# => "URI::InvalidURIError: expected file:// scheme: "
Ah. You're right, I missed that. It's probably nil since that's what resolve
returns when a file cant be found.
I don't have enough knowledge of commoner to make a guess as to what could have gone wrong, but if it can no longer be reproduced it's probably not worth more investigation.
I just ran into this issue and I'm wondering if it's related to an issue I ran into here: https://github.com/rails/sprockets/issues/451
remote: URI::InvalidURIError: expected file:// scheme:
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/app/assets/config/manifest.js:1
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/uri_utils.rb:94:in `parse_asset_uri'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/unloaded_asset.rb:134:in `load_file_params'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/unloaded_asset.rb:64:in `params'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:34:in `load'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-commoner-0.6.4/lib/sprockets/commoner/bundle.rb:70:in `block in call'
remote: /tmp/build_02fbcf7b380e429bf9912ee9e770601c/vendor/bundle/ruby/2.4.0/gems/sprockets-commoner-0.6.4/lib/sprockets/commoner/bundle.rb:64:in `map'
Full stack here: https://gist.github.com/dimroc/7cedcf211e966fb1065b18ce3313fc79
Ohhh I just realized we don't run into this because our manifest.js is not included in our commoner compilation. I can probably reproduce this now
I've never run into this locally, only when deploying to Heroku. For anyone else that stumbles into this, you can get by with heroku repo:purge_cache
. But that might be a temporary fix.
Same problem over here. @dimroc's solution works everytime for me as a crutch. Is there a more permanent solution that anyone has found?
For anyone else frustrated by this, I got around the problem by not using the new manifest.js and returning to the initializers/assets.rb
way of doing things. sprockets-commoner works fine in that scenario.
Rails.application.config.assets.version = '1.1.5'
Rails.application.config.assets.precompile += [
%w{client.js vendor.js},
%w{admin.css dealership.css}
].flatten
Got this issue today and @dimroc's solution worked. But we need to install Heroku Repo plugin first
Using Sprockets
4.0.0.beta4
, I got the error below when trying to deploy. Indevelopment
, everything worked fine, and addingexclude: ['vendor/bundle', 'app/assets/config']
in the initializer helped.app/assets/config/manifest.js
: