Rails devise+sidekiq: development 环境正常发信,生产环境发信失败报错

itsvoid · 2014年02月26日 · 最后由 itsvoid 回复于 2014年02月27日 · 2541 次阅读

错误发生在 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:42:in `find_scope!' 不知怎样debug,求教。

Using devise (2.1.2) Using devise-async (0.5.1)

2014-02-26T13:15:02Z 4398 TID-1iwifq Devise::Async::Backend::Sidekiq JID-9f5e59385b6152dffc70b894 INFO: start
  6 2014-02-26T13:15:02Z 4398 TID-1iwifq Devise::Async::Backend::Sidekiq JID-9f5e59385b6152dffc70b894 INFO: fail: 0.021 sec
  7 2014-02-26T13:15:02Z 4398 TID-1iwifq WARN: {"retry"=>true, "queue"=>"mailer", "class"=>"Devise::Async::Backend::Sidekiq", "args"=>["reset_password_instr    uctions", "User", "5155441417f9233ae0000001"], "jid"=>"9f5e59385b6152dffc70b894", "error_message"=>"Could not find a valid mapping for nil", "error_clas    s"=>"RuntimeError", "failed_at"=>"2014-02-26T13:11:43Z", "retry_count"=>3, "retried_at"=>2014-02-26 13:15:02 UTC}
  8 2014-02-26T13:15:02Z 4398 TID-1iwifq WARN: Could not find a valid mapping for nil
  9 2014-02-26T13:15:02Z 4398 TID-1iwifq WARN: /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:42:in `find_scope!'
 10 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mailers/helpers.rb:20:in `initialize_from_record'
 11 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mailers/helpers.rb:15:in `devise_mail'
 12 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/app/mailers/devise/mailer.rb:9:in `reset_password_instructions'
 13 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/base.rb:167:in `process_action'
 14 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/base.rb:121:in `process'
 15 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/rendering.rb:45:in `process'
 16 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:457:in `process'
 17 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:452:in `initialize'
 18 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:439:in `new'
 19 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:439:in `method_missing'
 20 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-async-0.5.1/lib/devise/async/backend/base.rb:15:in `perform'
 21 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/processor.rb:49:in `block (3 levels) in process'
 22 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:109:in `call'
 23 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:109:in `block in invoke'
 24 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/timeout.rb:14:in `call'
 25 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
 26 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
 27 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
 28 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/retry_jobs.rb:50:in `call'
 29 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
 30 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
 31 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/logging.rb:22:in `with_context'
 32 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/logging.rb:7:in `call'
 33 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
 34 /usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:114:in `call'
共收到 2 条回复

是不是production环境下没有正确配置SMTP?

#1楼 @Martin91 我用的是devise-async。奇怪的是,生产环境之前发邮件是正常的,后来网站停过一段时间,重起VPS以后就不行了。

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