Eroare de e-mail - Rails 3 Heroku Staging App

Buna ziua,

Am o aplicație care rulează pe Heroku cu o aplicație identică de așteptare. Totul ar trebui să fie exact același dintre cele două, cu excepția faptului că am copiat peste mediu/production.rb la mediu/staging.rb.

Am schimbat și variabilele de mediu:

RACK_ENV=staging
RAILS_ENV=staging

E-mailul va trimite exact cum era de așteptat în aplicația mea de producție, dar când mă duc să o trimit în aplicația mea de staționare, aceasta nu reușește în mod mizerabil:

!ruby/ActiveRecord:Delayed::Backend::ActiveRecord::Job 
  attributes: 
    id: 6
    priority: 0
    attempts: 2
    handler: |
      --- !ruby/object:Delayed::PerformableMailer 
      args: 
      - 3
      method_name: :admin_notification_signup
      object: !ruby/class UserMailer

    last_error: |-
      {undefined method `index' for :email:Symbol
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/encodings.rb:117:in `value_decode'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/encodings.rb:101:in `decode_encode'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:64:in `do_decode'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:46:in `decoded'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:115:in `fold'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:96:in `wrapped_value'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:60:in `do_encode'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:42:in `encoded'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/field.rb:133:in `method_missing'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:190:in `block in encoded'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:189:in `each'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:189:in `encoded'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:1708:in `encoded'
      /app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:433:in `set_payload_for_mail'
      /app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:413:in `block in deliver_mail'
      /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'
      /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'
      /app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:412:in `deliver_mail'
      /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/performable_mailer.rb:6:in `perform'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:94:in `block in invoke_job'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:91:in `invoke_job'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block (2 levels) in run'
      /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block in run'
      /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:177:in `run'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `block in reserve_and_run_one_job'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `reserve_and_run_one_job'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:162:in `block in work_off'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `times'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `work_off'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:133:in `block (4 levels) in start'
      /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:132:in `block (3 levels) in start'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:129:in `block (2 levels) in start'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `loop'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `block in start'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in '
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block in add'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:127:in `start'
      /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/tasks.rb:9:in `block (2 levels) in '
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
      /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
      /app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `'
      /app/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
      /app/vendor/bundle/ruby/1.9.1/bin/rake:23:in `
' run_at: 2012-06-02 20:49:55.976158 Z locked_at: failed_at: locked_by: queue: created_at: 2012-06-02 20:49:31.768212 Z updated_at: 2012-06-02 20:49:34.977784 Z

Știe cineva ce ar putea cauza asta? Folosesc bijuteria Roadie pentru a-mi personaliza postul.

user_mailer.rb:

class UserMailer < ActionMailer::Base

  default :css => :email, from: "Admin "

  host = ENV['HOST'].gsub(/http:\/\//, "")
  default_url_options[:host] = host

  ......

config:

config.action_mailer.delivery_method = :smtp

config.action_mailer.default :charset => "utf-8"

config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => "587",
  :domain               => "gmail.com",
  :user_name            => ENV['EMAIL_USER'],
  :password             => ENV['EMAIL_PASS'],
  :authentication       => "plain",
  :enable_starttls_auto => true
}
0

1 răspunsuri

Ca punct de date, am avut aceeasi eroare cand am avut:

  default :css => :email

în mailer de dezvoltare când nu am instalat roadie. Deci, puteți verifica dacă pietrele pe care le aveți în ambele medii sunt corecte.

For the error we got, I think basically the mailing portion of Rails sees the :css => :email portion and says "I don't know what this symbol means." Normally roadie intercepts this or transforms it somehow, but when I didn't have it installed, it didn't strip it out of the params, so it got all the way to the mailer.

0
adăugat