Skip to content
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

assets:precompile fails in production due to missing manifest.yml #594

Closed
1 of 4 tasks
drborges opened this issue Aug 29, 2016 · 10 comments
Closed
1 of 4 tasks

assets:precompile fails in production due to missing manifest.yml #594

drborges opened this issue Aug 29, 2016 · 10 comments

Comments

@drborges
Copy link
Contributor

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

rake assets:precompile:all fails while deploying to production. I suspect the problem is that I have the following configuration:

config.assets.compile = false
config.assets.prefix = "ui"

Which causes the manifest.yml to be generated under public/ui instead of public/assets, thus failing the initialization of the YamlManifestContainer

On a quick attempt to fix the issue, I tried this but then, assets:precompile fails cause it cannot find react-server.js. Any thoughts?

Stacktrace:

INFO [c27b9bb2] Running bundle exec rake assets:precompile as omitted@omitted
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as omitted@omitted: rake exit status: 1
rake stdout: Nothing written
rake stderr: /usr/bin/ruby2.2 /data/shared/bundle/ruby/2.2.0/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /data/release/public/assets/manifest.yml
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/yaml_manifest_container.rb:9:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/sprockets_renderer.rb:67:in `new'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/sprockets_renderer.rb:67:in `asset_container'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/sprockets_renderer.rb:22:in `block in initialize'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/sprockets_renderer.rb:21:in `each'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering/sprockets_renderer.rb:21:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering.rb:22:in `new'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering.rb:22:in `create_renderer'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering.rb:12:in `block in reset_pool'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `block in initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `new'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:48:in `new'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:48:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering.rb:12:in `new'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/server_rendering.rb:12:in `reset_pool'
/data/shared/bundle/ruby/2.2.0/gems/react-rails-1.8.2/lib/react/rails/railtie.rb:90:in `block in <class:Railtie>'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:34:in `call'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:42:in `each'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `instance_exec'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `run'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:55:in `block in run_initializers'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `each'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `run_initializers'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:136:in `initialize!'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
/data/release/config/environment.rb:8:in `<top (required)>'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:103:in `require_environment!'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/data/shared/bundle/ruby/2.2.0/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:190:in `block (2 levels) in <top (required)>'
@drborges drborges changed the title assets:precompile fails in production cause it cannot find manifest.yml assets:precompile fails in production due to missing manifest.yml Aug 29, 2016
@rmosolgo
Copy link
Member

Sorry about that!

assets:precompile fails cause it cannot find react-server.js

Could you share the stack trace for that?

@drborges
Copy link
Contributor Author

No need to be sorry :)

Just to highlight, that only happens with the potential fix for the missing manifest I mentioned above, here's the stack trace:

$ bundle exec rake assets:precompile RAILS_ENV=production
/usr/bin/ruby2.2 /data/shared/bundle/ruby/2.2.0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
No compiled asset for react-server.js, was it precompiled?
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering/yaml_manifest_container.rb:13:in `find_asset'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering/sprockets_renderer.rb:22:in `block in initialize'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering/sprockets_renderer.rb:21:in `each'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering/sprockets_renderer.rb:21:in `initialize'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering.rb:22:in `new'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering.rb:22:in `create_renderer'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering.rb:12:in `block in reset_pool'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `block in initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `new'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool/timed_stack.rb:9:in `initialize'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:48:in `new'
/data/shared/bundle/ruby/2.2.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:48:in `initialize'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering.rb:12:in `new'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/server_rendering.rb:12:in `reset_pool'
/data/shared/bundle/ruby/2.2.0/bundler/gems/react-rails-11ba9bda3910/lib/react/rails/railtie.rb:90:in `block in <class:Railtie>'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:34:in `call'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:42:in `each'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `instance_exec'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `run'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:55:in `block in run_initializers'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `each'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `run_initializers'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:136:in `initialize!'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
/data/releases/20160829174816/config/environment.rb:8:in `<top (required)>'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
/data/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:103:in `require_environment!'
/data/shared/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/data/shared/bundle/ruby/2.2.0/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:190:in `block (2 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/bin/ruby2.2 /data/shared...]
/data/shared/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/data/shared/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/data/shared/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/var/lib/gems/2.2.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

@drborges
Copy link
Contributor Author

the issue regarding the react-server.js could be a side effect of my attempt to fix the missing manifest.yml.

@rmosolgo
Copy link
Member

rmosolgo commented Aug 29, 2016

Is react-server configured to be precompiled? eg

Rails.application.config.assets.precompile += ['react-server.js']

This is needed in some cases but I can't remember which :S

@drborges
Copy link
Contributor Author

It is not, let me try that.

@drborges
Copy link
Contributor Author

didn't work.

what should be the path for react-server.js?

@drborges
Copy link
Contributor Author

shouldn't I see react-server.js in my manifest.yml?

@rmosolgo
Copy link
Member

shouldn't I see react-server.js in my manifest.yml?

Yes, I think so, but I don't understand why it doesnt :S

The last suggestion I have is to do a wholesale workaround: #443 (comment)

Sadly react-rails has these defaults for the asset pipeline, but then when the asset pipeline is configured differently, the defaults don't work! 😖 I want to change those defaults but it will be a breaking change, so I've put it off!

@drborges
Copy link
Contributor Author

Thanks for the help @rmosolgo, I'll try that next.

@rmosolgo
Copy link
Member

rmosolgo commented Dec 9, 2016

I hope it worked for you after that patch!

@rmosolgo rmosolgo closed this as completed Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants