1

我有一个使用 OminAuth 的 rails 3 应用程序。我正在使用文件“config/initializers/omniauth.rb”对其进行初始化:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, "...", "..."
  provider :identity, :on_failed_registration => lambda { |env| IdentitiesController.action(:new).call(env) }

  OmniAuth.config.on_failure = Proc.new { |env|
    OmniAuth::FailureEndpoint.new(env).redirect_to_failure
  }
end

它在使用 WEBrick 的开发中正常工作,但在生产(nginx + unicorn)上,应用程序挂起并且 unicorn.log 显示以下内容:

E, [2013-04-11T14:45:41.485066 #3276] ERROR -- : reaped #<Process::Status: pid 18825 exit 1> worker=1
I, [2013-04-11T14:45:41.485439 #3276]  INFO -- : worker=1 spawning...
I, [2013-04-11T14:45:41.491241 #18831]  INFO -- : worker=1 spawned pid=18831
I, [2013-04-11T14:45:41.491662 #18831]  INFO -- : Refreshing Gem list
E, [2013-04-11T14:45:41.622456 #18828] ERROR -- : uninitialized constant OmniAuth (NameError)
/home/insidegui/apps/curtaavida/releases/20130411173917/config/initializers/omniauth.rb:1:in `<top (required)>'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/home/insidegui/apps/curtaavida/shared/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/insidegui/apps/curtaavida/releases/20130411173917/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require'
config.ru:4:in `block in <main>'

我的 production.log 保持干净。

我应该怎么办?

4

1 回答 1

0

好吧,我停止了独角兽进程并再次启动它,现在它可以工作了。我做了一个新的上限:部署它现在似乎工作得很好......奇怪......

于 2013-04-11T19:38:01.203 回答