Skip to content

Server rendering crashes in production with sprockets-rails < 2.2.2  #544

@tf

Description

@tf

#430 introduced the ManifestContainer which uses Rails.application.assets_manifest. This method was introduced by sprockets-rails 2.2.2. If Rails.config.assets.compile is set to false (which it is by default in production) SprocketsRenderer no longer uses EnvironmentContainer and causes the exception:

ActionView::Template::Error (undefined method `assets_manifest' for #<Xxx::Application:0x007f5464c7b180>):

  react-rails (1.6.2) lib/react/server_rendering/manifest_container.rb:9:in `initialize'
  react-rails (1.6.2) lib/react/server_rendering/sprockets_renderer.rb:70:in `new'
  react-rails (1.6.2) lib/react/server_rendering/sprockets_renderer.rb:70:in `asset_container'
  react-rails (1.6.2) lib/react/server_rendering/sprockets_renderer.rb:22:in `block in initialize'

I can see two possibilities:

  1. Fallback to EnvironmentContainer for sprockets-rails < 2.2.2
  2. Make the sprockets-rails dependency explicit

There are Rails version though (e.g. 4.0.5) that depend on sprocket-rails ~> 2.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions