railsadminteam/rails_admin

The asset "rails_admin/rails_admin.css" is not present in the asset pipeline.

aabed opened this issue · 7 comments

aabed commented

Reproduction steps
Follow the installation guide and then
Expected behavior
admin to be served from /admin

Additional context

  • rails version: 6.0.5.1
  • rails_admin version: 2.0.2 I have also tried latest
  • rails_admin npm package version:
  • full stack trace (if there's an exception)
{"timestamp":"2023-04-08T16:48:40.818112Z","level":"INFO","logger":"Rails","message":{"method":"GET","path":"/admin/","format":"html","controller":"RailsAdmin::MainController","action":"dashboard","status":500,"error":"ActionView::Template::Error: The asset \"rails_admin/rails_admin.css\" is not present in the asset pipeline.\n","duration":28054.11,"view":0.0,"db":21563.25,"dd":{"trace_id":2924225740902310122,"span_id":448161760231428130},"ddsource":["ruby"],"params":{}}}
{"timestamp":"2023-04-08T16:48:40.828096Z","level":"FATAL","logger":"Rails","message":"  \nActionView::Template::Error (The asset \"rails_admin/rails_admin.css\" is not present in the asset pipeline.\n):\n    3: %meta{content: \"width=device-width, initial-scale=1\", name: \"viewport; charset=utf-8\"}\n    4: %meta{content: \"NONE,NOARCHIVE\", name: \"robots\"}\n    5: = csrf_meta_tag\n    6: = stylesheet_link_tag \"rails_admin/rails_admin.css\", media: :all\n    7: = javascript_include_tag \"rails_admin/rails_admin.js\"\n  \nsprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:84:in `compute_asset_path'\nactionview (6.0.5.1) lib/action_view/helpers/asset_url_helper.rb:201:in `asset_path'\nactionview (6.0.5.1) lib/action_view/helpers/asset_url_helper.rb:346:in `stylesheet_path'\nactionview (6.0.5.1) lib/action_view/helpers/asset_tag_helper.rb:143:in `block in stylesheet_link_tag'\nactionview (6.0.5.1) lib/action_view/helpers/asset_tag_helper.rb:142:in `map'\nactionview (6.0.5.1) lib/action_view/helpers/asset_tag_helper.rb:142:in `stylesheet_link_tag'\nsprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:180:in `block in stylesheet_link_tag'\nsprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:170:in `map'\nsprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:170:in `stylesheet_link_tag'\nrails_admin (2.0.2) app/views/layouts/rails_admin/_head.html.haml:6\nactionview (6.0.5.1) lib/action_view/base.rb:274:in `_run'\nactionview (6.0.5.1) lib/action_view/template.rb:185:in `block in render'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `block in instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'\nsentry-rails (5.3.1) lib/sentry/rails/tracing.rb:54:in `instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `instrument'\nactionview (6.0.5.1) lib/action_view/template.rb:385:in `instrument_render_template'\nactionview (6.0.5.1) lib/action_view/template.rb:183:in `render'\nactionview (6.0.5.1) lib/action_view/renderer/partial_renderer.rb:357:in `block in render_partial'\nactionview (6.0.5.1) lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `block in instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'\nsentry-rails (5.3.1) lib/sentry/rails/tracing.rb:54:in `instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `instrument'\nactionview (6.0.5.1) lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'\nactionview (6.0.5.1) lib/action_view/renderer/partial_renderer.rb:346:in `render_partial'\nactionview (6.0.5.1) lib/action_view/renderer/partial_renderer.rb:317:in `render'\nactionview (6.0.5.1) lib/action_view/renderer/renderer.rb:65:in `render_partial_to_object'\nactionview (6.0.5.1) lib/action_view/renderer/renderer.rb:53:in `render_partial'\nactionview (6.0.5.1) lib/action_view/helpers/rendering_helper.rb:38:in `render'\nhaml (5.2.2) lib/haml/helpers/action_view_mods.rb:13:in `block in render'\nhaml (5.2.2) lib/haml/helpers.rb:93:in `non_haml'\nhaml (5.2.2) lib/haml/helpers/action_view_mods.rb:13:in `render'\nrails_admin (2.0.2) app/views/layouts/rails_admin/application.html.haml:4\nactionview (6.0.5.1) lib/action_view/base.rb:274:in `_run'\nactionview (6.0.5.1) lib/action_view/template.rb:185:in `block in render'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `block in instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'\nsentry-rails (5.3.1) lib/sentry/rails/tracing.rb:54:in `instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `instrument'\nactionview (6.0.5.1) lib/action_view/template.rb:385:in `instrument_render_template'\nactionview (6.0.5.1) lib/action_view/template.rb:183:in `render'\nactionview (6.0.5.1) lib/action_view/renderer/template_renderer.rb:69:in `render_with_layout'\nactionview (6.0.5.1) lib/action_view/renderer/template_renderer.rb:56:in `render_template'\nactionview (6.0.5.1) lib/action_view/renderer/template_renderer.rb:13:in `render'\nactionview (6.0.5.1) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'\nactionview (6.0.5.1) lib/action_view/renderer/renderer.rb:29:in `render_to_object'\nactionview (6.0.5.1) lib/action_view/rendering.rb:117:in `block in _render_template'\nactionview (6.0.5.1) lib/action_view/base.rb:304:in `in_rendering_context'\nactionview (6.0.5.1) lib/action_view/rendering.rb:116:in `_render_template'\nactionpack (6.0.5.1) lib/action_controller/metal/streaming.rb:218:in `_render_template'\nactionview (6.0.5.1) lib/action_view/rendering.rb:103:in `render_to_body'\nactionpack (6.0.5.1) lib/action_controller/metal/rendering.rb:52:in `render_to_body'\nactionpack (6.0.5.1) lib/action_controller/metal/renderers.rb:142:in `render_to_body'\nactionpack (6.0.5.1) lib/abstract_controller/rendering.rb:25:in `render'\nactionpack (6.0.5.1) lib/action_controller/metal/rendering.rb:36:in `render'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'\nactivesupport (6.0.5.1) lib/active_support/core_ext/benchmark.rb:14:in `block in ms'\n/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'\nactivesupport (6.0.5.1) lib/active_support/core_ext/benchmark.rb:14:in `ms'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:44:in `block in render'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'\nactiverecord (6.0.5.1) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:43:in `render'\nremotipart (1.4.4) lib/remotipart/render_overrides.rb:23:in `render'\nrails_admin (2.0.2) lib/rails_admin/config/actions/dashboard.rb:37:in `block (2 levels) in \u003cclass:Dashboard\u003e'\nrails_admin (2.0.2) app/controllers/rails_admin/main_controller.rb:22:in `instance_eval'\nrails_admin (2.0.2) app/controllers/rails_admin/main_controller.rb:22:in `dashboard'\nactionpack (6.0.5.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'\nactionpack (6.0.5.1) lib/abstract_controller/base.rb:195:in `process_action'\nddtrace (1.4.0) lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb:129:in `process_action'\nactionpack (6.0.5.1) lib/action_controller/metal/rendering.rb:30:in `process_action'\nactionpack (6.0.5.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'\nactivesupport (6.0.5.1) lib/active_support/callbacks.rb:112:in `block in run_callbacks'\nactiontext (6.0.5.1) lib/action_text/rendering.rb:19:in `with_renderer'\nactiontext (6.0.5.1) lib/action_text/engine.rb:55:in `block (4 levels) in \u003cclass:Engine\u003e'\nactivesupport (6.0.5.1) lib/active_support/callbacks.rb:121:in `instance_exec'\nactivesupport (6.0.5.1) lib/active_support/callbacks.rb:121:in `block in run_callbacks'\nactivesupport (6.0.5.1) lib/active_support/callbacks.rb:139:in `run_callbacks'\nactionpack (6.0.5.1) lib/abstract_controller/callbacks.rb:41:in `process_action'\nactionpack (6.0.5.1) lib/action_controller/metal/rescue.rb:22:in `process_action'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `block in instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'\nsentry-rails (5.3.1) lib/sentry/rails/tracing.rb:54:in `instrument'\nactivesupport (6.0.5.1) lib/active_support/notifications.rb:180:in `instrument'\nactionpack (6.0.5.1) lib/action_controller/metal/instrumentation.rb:32:in `process_action'\nactionpack (6.0.5.1) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'\nactiverecord (6.0.5.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'\nactionpack (6.0.5.1) lib/abstract_controller/base.rb:136:in `process'\nactionview (6.0.5.1) lib/action_view/rendering.rb:39:in `process'\nactionpack (6.0.5.1) lib/action_controller/metal.rb:190:in `dispatch'\nactionpack (6.0.5.1) lib/action_controller/metal.rb:254:in `dispatch'\nactionpack (6.0.5.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'\nactionpack (6.0.5.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:49:in `block in serve'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:32:in `each'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'\nactionpack (6.0.5.1) lib/action_dispatch/routing/route_set.rb:834:in `call'\nrailties (6.0.5.1) lib/rails/engine.rb:527:in `call'\nrailties (6.0.5.1) lib/rails/railtie.rb:190:in `public_send'\nrailties (6.0.5.1) lib/rails/railtie.rb:190:in `method_missing'\nactionpack (6.0.5.1) lib/action_dispatch/routing/mapper.rb:19:in `block in \u003cclass:Constraints\u003e'\nactionpack (6.0.5.1) lib/action_dispatch/routing/mapper.rb:48:in `serve'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:49:in `block in serve'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:32:in `each'\nactionpack (6.0.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'\nactionpack (6.0.5.1) lib/action_dispatch/routing/route_set.rb:834:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack-pjax (1.1.0) lib/rack/pjax.rb:12:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/rack/browser_monitoring.rb:38:in `traced_call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'\nrack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/method_override.rb:24:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/cookies.rb:654:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nremotipart (1.4.4) lib/remotipart/middleware.rb:32:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/etag.rb:27:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/conditional_get.rb:27:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/head.rb:12:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/http/content_security_policy.rb:18:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'\nrack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/cookies.rb:654:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'\nactivesupport (6.0.5.1) lib/active_support/callbacks.rb:101:in `run_callbacks'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nsentry-rails (5.3.1) lib/sentry/rails/rescued_exception_interceptor.rb:12:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nddtrace (1.4.0) lib/datadog/tracing/contrib/rails/middlewares.rb:19:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nsentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:26:in `block (2 levels) in call'\nsentry-ruby-core (5.3.1) lib/sentry/hub.rb:199:in `with_session_tracking'\nsentry-ruby-core (5.3.1) lib/sentry-ruby.rb:351:in `with_session_tracking'\nsentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:17:in `block in call'\nsentry-ruby-core (5.3.1) lib/sentry/hub.rb:59:in `with_scope'\nsentry-ruby-core (5.3.1) lib/sentry-ruby.rb:331:in `with_scope'\nsentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:16:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nlograge (0.12.0) lib/lograge/rails_ext/rack/logger.rb:18:in `call_app'\nrailties (6.0.5.1) lib/rails/rack/logger.rb:28:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrequest_store (1.5.1) lib/request_store/middleware.rb:19:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/method_override.rb:24:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/runtime.rb:22:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactivesupport (6.0.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack (2.2.4) lib/rack/sendfile.rb:110:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nactionpack (6.0.5.1) lib/action_dispatch/middleware/host_authorization.rb:97:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack-cors (1.1.1) lib/rack/cors.rb:100:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nddtrace (1.4.0) lib/datadog/tracing/contrib/rack/middlewares.rb:83:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrack-cors (1.1.1) lib/rack/cors.rb:100:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\nrailties (6.0.5.1) lib/rails/engine.rb:527:in `call'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'\npuma (5.6.4) lib/puma/configuration.rb:252:in `call'\npuma (5.6.4) lib/puma/request.rb:77:in `block in handle_request'\npuma (5.6.4) lib/puma/thread_pool.rb:340:in `with_force_shutdown'\npuma (5.6.4) lib/puma/request.rb:76:in `handle_request'\npuma (5.6.4) lib/puma/server.rb:441:in `process_client'\npuma (5.6.4) lib/puma/thread_pool.rb:147:in `block in spawn_thread'\nlogging (2.3.0) lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/tracer.rb:434:in `block (2 levels) in thread_block_with_current_transaction'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/tracer.rb:356:in `capture_segment_error'\nnewrelic_rpm (9.1.0) lib/new_relic/agent/tracer.rb:433:in `block in thread_block_with_current_transaction'"}

Add any other context about the problem here.

application.rb

module YallaWain
  class Application < Rails::Application
    config.assets.precompile += %w(rails_admin/rails_admin.css rails_admin/rails_admin.js)
    config.middleware.use ActionDispatch::Cookies
    config.middleware.use ActionDispatch::Flash
    config.middleware.use Rack::MethodOverride
    config.assets.debug = true

    config.middleware.use ActionDispatch::Session::CookieStore, {:key=>"_yw_session"}
    config.middleware.insert_before 0, Rack::Cors do
      allow do
        origins '*'

        resource '*',
                 headers: :any,
                 methods: %i(get post put patch delete options)
      end
    end

config/initializers/assets.rb

Rails.application.config.assets.enabled = true
# Prevent initializing the application before assets are precompiled (required for heroku)
Rails.application.config.assets.initialize_on_precompile = false
# Add Rails Admin assets (required)
Rails.application.config.assets.precompile += ['rails_admin/rails_admin.css', 'rails_admin/rails_admin.js']

They are renamed to rails_admin/application.css and rails_admin/application.js since the version 3.0.0.
3d7f3b3

aabed commented

@mshibuya I am using 2.0.2

Please reopen the issue, you closed it under wrong assumption

Ah sorry, then read the StackOverflow links in #3395.

aabed commented

@mshibuya as you can see my config/initializers/assets.rb is exactly what is in the SO post
I also run the precompile and still get the same error

Good, then what the author of this answer concluded?
https://stackoverflow.com/a/69345457

aabed commented

I have checked this one as well, of course I didn't follow the heroku steps because I am not deploying to heroku

I have followed all SO posts, I have asked chat GPT and I still get the error

Is there any extra information that might spot the problem I can provide

aabed commented

I ditched and used motoradmin instead
Thanks