Rails "ActionController::RoutingError: No route matches" in CI
Rails could not match the requested path to any route. When this happens only in CI, the test environment is missing a route that exists in development, often an engine mount, an asset path, or a route guarded by an environment condition.
What this error means
A request or system test fails with "ActionController::RoutingError: No route matches [GET] \"/path\"" that passes locally.
Rails
ActionController::RoutingError:
No route matches [GET] "/rails/active_storage/blobs/redirect/..."Common causes
A route is conditional on the environment
Routes wrapped in if Rails.env.development? (or mounted only outside test) are absent when the suite runs under test.
A dependent engine or asset route is not loaded
Active Storage, an engine, or an asset route was not mounted or compiled in CI, so the path has no match.
How to fix it
Mount the route for the test environment
- Confirm which path the error names and where it is defined.
- Remove or widen an environment guard so the route exists in test.
- For asset paths, ensure assets are precompiled so their routes resolve.
config/routes.rb
# config/routes.rb - mount the engine in all environments
mount Sidekiq::Web => "/sidekiq"Inspect routes in CI
List the routes the test environment actually loads to see what is missing.
Terminal
RAILS_ENV=test bin/rails routes | grep active_storageHow to prevent it
- Avoid environment-conditional routes that tests depend on.
- Precompile assets so asset routes resolve in CI.
- Run bin/rails routes to diff development vs test route tables.
Related guides
Rails "NameError: uninitialized constant" (eager_load in test) in CIFix Rails "NameError: uninitialized constant" that only appears in CI - eager loading in the test environment…
Rails Active Storage service not configured for test in CIFix Rails Active Storage failures in CI where the configured storage service is missing - point test at the :…
Rails "Webpacker::Manifest::MissingEntryError" in CIFix Rails "Webpacker::Manifest::MissingEntryError" (or Shakapacker) in CI - the JS pack was never compiled, s…