Rails 今天部署 Rails 项目,部署完以后,puma 中断报错了。

mz2test · 发布于 2017年09月14日 · 最后由 mz2test 回复于 2017年09月14日 · 329 次阅读
21346
Using RVM environment "ruby-2.3.1"
       Using /usr/local/rvm/gems/ruby-2.3.1
-----> Starting Puma...
       [15235] Puma starting in cluster mode...
       [15235] * Version 3.10.0 (ruby 2.3.1-p112), codename: Russell's Teapot
       [15235] * Min threads: 2, max threads: 16
       [15235] * Environment: production
       [15235] * Process workers: 2
       [15235] * Preloading application
       [15235] ! Unable to load application: ArgumentError: Before process_action callback :verify_authenticity_token has not been defined
       bundler: failed to load command: puma (/var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/bin/puma)
       ArgumentError: Before process_action callback :verify_authenticity_token has not been defined
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:712:in `block (2 levels) in skip_callback'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:708:in `each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:708:in `block in skip_callback'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:622:in `block in __update_callbacks'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:620:in `reverse_each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:620:in `__update_callbacks'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:707:in `skip_callback'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:181:in `block (3 levels) in <module:ClassMethods>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:74:in `block in _insert_callbacks'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:73:in `each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:73:in `_insert_callbacks'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:180:in `block (2 levels) in <module:ClassMethods>'
         /var/www/lxyin_api/shared/vendor/bundle/ruby/2.3.0/bundler/gems/rails_kindeditor-00fb549580d1/app/controllers/kindeditor/assets_controller.rb:4:in `<class:AssetsController>'
         /var/www/lxyin_api/shared/vendor/bundle/ruby/2.3.0/bundler/gems/rails_kindeditor-00fb549580d1/app/controllers/kindeditor/assets_controller.rb:3:in `<top (required)>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:379:in `block in require_or_load'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:36:in `block in load_interlock'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:11:in `loading'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:36:in `load_interlock'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:357:in `require_or_load'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:335:in `depend_on'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:251:in `require_dependency'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:475:in `each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:475:in `block in eager_load!'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:473:in `each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:473:in `eager_load!'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/engine.rb:354:in `eager_load!'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/application/finisher.rb:67:in `each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/application/finisher.rb:67:in `block in <module:Finisher>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `instance_exec'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `run'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/initializable.rb:59:in `block in run_initializers'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
         /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/initializable.rb:58:in `run_initializers'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/application.rb:353:in `initialize!'
         /var/www/lxyin_api/releases/1/config/environment.rb:5:in `<top (required)>'
         config.ru:3:in `require_relative'
         config.ru:3:in `block in <main>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
         config.ru:in `new'
         config.ru:in `<main>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/configuration.rb:314:in `load_rackup'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/configuration.rb:243:in `app'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/runner.rb:138:in `load_and_bind'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/cluster.rb:397:in `run'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/launcher.rb:183:in `run'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/lib/puma/cli.rb:77:in `run'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/gems/puma-3.10.0/bin/puma:10:in `<top (required)>'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/bin/puma:23:in `load'
         /var/www/lxyin_api/releases/1/vendor/bundle/ruby/2.3.0/bin/puma:23:in `<top (required)>'

请教一下,这是什么原因导致的。

共收到 4 条回复
De6df3

错误原因是:

ArgumentError: Before process_action callback :verify_authenticity_token has not been defined

一些参考:

https://github.com/galetahub/ckeditor/pull/749 https://github.com/plataformatec/devise/issues/4207

Bdefa7
! Unable to load application: ArgumentError: Before process_action callback :verify_authenticity_token has not been defined

你这个回调方法名没定义?检查方法名是不是写错

21346
De6df3huacnlee 回复

我想使用的是在 ApplicationController 中调用 skip_before_action :verify_authenticity_token这个回调,之前没问题,这次添加了一个Rails_kindeditor以后就报错了。如果不加就报CRSF的错误。

21346
Bdefa7chromer 回复

是Rails框架中的方法,不过是个private方法。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册