Chrismisballs
Chrismisballs

Reputation: 320

Sprockets::Rails::Helper::AssetNotPrecompiled in ResqueWeb

I've been trying to fix this for about two days but I'm getting no where. I'm trying to get the resque-web page to show but I keep running into the error

Sprockets::Rails::Helper::AssetNotPrecompiled in ResqueWeb::Overview#show

Message shown

ActionView::Template::Error (resque_web/plugins/resque_scheduler/application.css):
    12:         file_path = "#{p.name.underscore.downcase}/application.css"
    13:         if (Rails.application.assets && Rails.application.assets.find_asset(file_path)) ||
    14:            (Rails.application.assets_manifest && Rails.application.assets_manifest.assets[file_path])
    15:           stylesheet_link_tag "#{p.name.underscore.downcase}/application"
    16:         end
    17:       end.join("\n").html_safe
    18:   %>

what is being called from the stack

     def raise_unless_precompiled_asset(path)
        raise Helper::AssetNotPrecompiled.new(path) if @check_precompiled_asset && !precompiled?(path)
      end
  end
end

gem versions

resque (2.0.0)
resque-multi-job-forks (0.5.1)
resque-scheduler (4.4.0)
resque-web (0.0.12)
sprockets (4.0.2, 3.7.2)
sprockets-rails (3.2.2)

routes.rb

require "resque_web"
require 'resque-scheduler'
require 'resque/scheduler/server'

Rails.application.routes.draw do
  mount ResqueWeb::Engine => "/resque_web"
  root to: "pages#home"
.
.
.
end

Ideally it will be 'admin/resque_web' for production purposes.

I've tried this fix by "bitterloa" https://github.com/resque/resque-web/issues/106 because my file structure is set the same using webpacker

I've looked and the development.rb to check that debugging is false

I've recompiled my assets after destroying them using sprock-rails rails assets:clobber

Any ideas where I can look or if anyone else has run into this problem lend a hand please.

Run commands from terminal shows that resque is running and accepting schedule jobs from my scheduler.yml file I just can't get the css for it to work.

If you need any more info let me know.

Thanks

Upvotes: 2

Views: 446

Answers (2)

RoRFan
RoRFan

Reputation: 424

If you want to use resque-web then in order to fix this issue you will need to add in assets.rb:

Rails.application.config.assets.precompile += %w[idle lifebuoy poll rails working].map { |img| "resque_web/#{img}.png" }
Rails.application.config.assets.precompile += %w[resque_web/application.css]
Rails.application.config.assets.precompile += %w[resque_web/application.js]

Subsequently you will need to run: rake assets:precompile And the issue should be fixed.

Upvotes: 0

razvans
razvans

Reputation: 3251

resque comes with a built-in server. You do not need resque-web and it seems it is not maintained (last commit was on 2018).

Let's try this:

gem 'resque', require: 'resque/server'

#  routes.rb 
mount Resque::Server.new, :at => "admin/resque"

Make sure you allow just admins to access to that page in production. For that you could read about Route Constraints to do something like:

constraints IsResqueAllowed do
  mount Resque::Server.new, :at => "admin/resque"
end

class IsResqueAllowed 
 def self.matches?(request)
   # use the request to do something
 end
end
 

More information about securing the route here.

Upvotes: 2

Related Questions