SocketError:运行heroku时的getaddrinfo在Heroku App-Rails4上运行rake db:seed

时间:2014-09-23 11:46:19

标签: ruby-on-rails heroku

我正在使用Rails4 and ruby2.0.0。我把我的应用推到Heroku&当我运行heroku run rake db:seed

时,我收到此错误

运行rake db:seed附加到终端...向上,run.6298

  

渲染了devise / mailer / confirmation_instructions.html.erb(1.8ms)

     

发送邮件到xyz@gmail.com(29.3ms)rake aborted! SocketError:   getaddrinfo:名称解析暂时失败   /app/vendor/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in deliver!' /app/vendor/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in do_delivery'   /app/vendor/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in   发送邮件中的block in deliver' /app/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.0.1/lib/action_mailer/base.rb:456:in 阻止   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in   block in instrument' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/notifications/instrumenter.rb:20:in 仪器”   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in   instrument' /app/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.0.1/lib/action_mailer/base.rb:454:in deliver_mail”   /app/vendor/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in   deliver' /app/vendor/bundle/ruby/2.0.0/gems/devise-3.2.4/lib/devise/models/authenticatable.rb:173:in send_devise_notification”   /app/vendor/bundle/ruby/2.0.0/gems/devise-3.2.4/lib/devise/models/confirmable.rb:102:in   send_confirmation_instructions' /app/vendor/bundle/ruby/2.0.0/gems/devise-3.2.4/lib/devise/models/confirmable.rb:158:in send_on_create_confirmation_instructions'   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/callbacks.rb:386:in   _run__3822695918417406283__create__callbacks' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/callbacks.rb:80:in run_callbacks'   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/callbacks.rb:306:in   create_record' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/timestamp.rb:57:in create_record”   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/persistence.rb:477:in   create_or_update中的create_or_update' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/callbacks.rb:302:in 阻止   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/callbacks.rb:383:in   _run__3822695918417406283__save__callbacks' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/callbacks.rb:80:in run_callbacks'   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/callbacks.rb:302:in   create_or_update' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/persistence.rb:106:in 保存”   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/validations.rb:51:in   save' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/attribute_methods/dirty.rb:32:in 保存”   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:270:in block (2 levels) in save' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:326:in阻止在with_transaction_returning_status'   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in   block in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in within_new_transaction”   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in   transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:209:in交易”   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:323:in with_transaction_returning_status' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:270:in阻止保存'   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:281:in rollback_active_record_state!' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/transactions.rb:269:in save'/app/db/seeds.rb:8:在<top (required)>' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in加载'   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in block in load' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in load_dependency'   /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in load' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/engine.rb:540:in load_seed'   /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/tasks/database_tasks.rb:154:in   “任务:TOP =&gt;中的load_seed' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/railties/databases.rake:181:in 阻止(2个级别) db:seed(见完整   使用--trace运行任务跟踪

1 个答案:

答案 0 :(得分:2)

您正在种子文件中创建设计用户。设计自动发送一些电子邮件例如。 email_confirmation。

所以你必须为生产环境设置一个合适的ActionMailer。您可能正在使用另一个heroku服务。 E.g mailgun

您也可以在种子文件中bypass devise email_confirmation