-
Notifications
You must be signed in to change notification settings - Fork 62
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
Likely issue with rails 6.1.0-alpha #54
Comments
I also got this issue when upgrading my Rails app to 6.1.0.rc1: 2020-11-04 16:26:31 +0100 Rack app ("GET /assets/application-d202e7f926ea26f1a77ad108db4187a078d7c86bebf0e97e4fe24242cdc9c487.css" - (127.0.0.1)): #<NoMethodError: undefined method `match?' for #<ActionDispatch::FileHandler:0x00007f9009c58d48>>
2020-11-04 16:26:31 +0100 Rack app ("GET /assets/application-3e190496dea178b3bbd482d5809118b541c5a13462d8fccbe725158cbeac7d92.js" - (127.0.0.1)): #<NoMethodError: undefined method `match?' for #<ActionDispatch::FileHandler:0x00007f9009c58d48>>
... CSS/JS assets can't load so the system tests generate screenshots with only HTML and no styling applied. I also get errors such as However I believe my app actually does not need this. I'm not sure which one does the job, but between the app being deployed on Heroku and having CloudFlare in front of this, I checked that when I remove this gem |
I am experiencing this issue with Rails 6.1 on heroku. |
I don't have time to support this at the moment, but I'll be happy to receive a PR. |
If I'm understanding this correctly, the functionality provided by the class @romanbsd introduced this feature in 2013, here, and Rails introduced this in 2014 and then improved it over the years to offer much of the same abilities as @romanbsd baked into his. But the recent refactor of that class removed the interface this gem expected. To maintain expected behavior, it seems like a simple major/minor version check could be added and bypass this in the case of Rails 6.1+. I'll gladly put together a PR if I'm on the right track. ps - It seems there may be other aspects of this gem that are baked into Rails now, but I don't have time to dig through. |
# config/application.rb
-config.load_defaults 6.0
+config.load_defaults 6.1
Oh sorry, that was not the solution. The issue still exists😣 |
It's broken on Rails 6.1 and probably not needed any more: romanbsd/heroku-deflater#54
Could someone please clarify if this gem is useful for Rails 6.1+? We're also in a state where removing the gem makes our app work after upgrading to 6.1, but I'm trying to figure out if I should continue to follow this gem, or if it's obsolete. |
On our website with Rails 6.1 it became obsolete. We removed it. And added |
I also removed it, and replaced it with: config.middleware.use Rack::Deflater,
include: Rack::Mime::MIME_TYPES.select{|k, v| v =~ /text|json|javascript/ }.values.uniq,
if: lambda {|env, status, headers, body| body.body.length > 512 }
require 'rack/brotli'
config.middleware.use Rack::Brotli,
include: Rack::Mime::MIME_TYPES.select{|k, v| v =~ /text|json|javascript/ }.values.uniq,
if: lambda {|env, status, headers, body| body.body.length > 512 },
deflater: {
quality: 1
} at the end of application.rb. Note that the Brotli middleware requires the rack-brotli gem. This encodes javascript, css, and html with Brotli (if supported as per the request's Accepts header), or GZip otherwise. |
* Added compression in production on heroku testing this out as the propshaft asset compiler is only minifying currently and it looks like I would need cssbundler and jsbundler to handle this otherwise * pulled in some updates to the heroku compress gem * added exporter adapter and sprockets ... who knows??!? * found a bug about returning 500 error for some assets .. this might fix it https://fuzzyblog.io/blog/rails/2022/06/02/rails-7-madness-no-such-middleware-to-insert-before-actiondispatch-static.html * removing the heroku asset exporter since it doesn't work * revmoved the heroku stuff * reverting to the original configuration * sprockets exporter * added fork of heroku-deflater that is upgraded for rail 6.1 assets * test that heroku deflator is no longer required romanbsd/heroku-deflater#54 (comment) * explicitly set when to use Rack:Deflator / Brotli romanbsd/heroku-deflater#54 (comment) * attempt to constrain the use of the compressors * Updated bin/dev and bin/prod to switch back and forth between a prod and dev like experience. Added details of ngrok to DevNotes for remote access to localhost Added notes about setting the same ENV variables that are used in Heroku using the dotenv gem and .env.production Removed the interfont stylesheet link that was very large and not loading during production testing Added a database config section to use the osx local Postgres.app but in production the DATABASE_URL will override this The prod script 'builds' the app like in heroku and 'deploys' it to https://jitter.test with precompiled assets * Update of Gemfile.lock Added example of the heroku environment variables to copy to .env.production for bin/prod script * added a script to make testing prod simpler with bin/puma-dev-prod added clearer explanation about secrets to Devnotes added the dotenv-rails gem to support setting env variables like heroku does enabled access to ENV['HOST'] to support requests from https://jitter.prod or ngrok urls * added and extra layer of security for the production enviroment to filter requests passed from the ENV['host'] for example jitter.prod and from x-feature.herokuapp.com fixed a typo that showed up in the preview environment this kinda stinks but for heroku previewapps and ngrok apps we can't predict the subdomain to set ENV['HEROKU_APP_NAME'] * adjusted the config since production is blocked * grrr.. this is still blocking requests in heroku * added scripts to use https://jitter.test which is using rails development mode added scripts to use https://jitter.prod which builds like heroku deployment and uses postgres and local bundle and cached classes etc added some explanation in the DevNotes upgraded a security fix that is actually pretter urgent from two days ago pupulated the .env.production with the heroku configs with and explanation and heroku sample since this is git ignored to protect secrets ngrok still needs a little debugging but for this PR i just needed the prod like build to work to examine the host.config problem in heroku * ENV['Host'] is working for jitter.prod locally but the hosts 403 error is still happening on heroku .. so trying som things * determined that the 403 error is coming from the default_url_options combined with config.hosts. Added the HEROKU_APP_NAME to fix this * ugghh fixed typo in herokuapp.com
We were getting errors like the ones described here, and followed the instructions provided! romanbsd/heroku-deflater#54
Also: - Decaffinate CoffeeScript to plain ES - Rewrite sass into vanilla CSS - Load js dependencies via CDN - Remove heroku-deflater (romanbsd/heroku-deflater#54)
Moves CSS from static files in the `public/assets` folder to the asset pipeline. Notes: * I removed the `heroku-deflater` gem due to an asset compilation bug I encountered on Heroku. The gem has [an open issue](romanbsd/heroku-deflater#54), but it doesn't seem worth worrying about right now (I'll likely use Cloudflare eventually, which will handle the PageSpeed requirement for gzip compression).
Using rails 00c2d3e1e61093451a00b1b70548cfd9ae549c53 as of this writing.
I'd guess this is related to this commit, which not only removes the
match?
method - it does away withFileHandler
in favor ofStatic
The text was updated successfully, but these errors were encountered: