質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

メール

メールは、コンピュータネットワークを利用し、 情報等を交換する手段のことです。

Q&A

2回答

2599閲覧

【Rails5】EOFError in Devise::PasswordsController#create

Goi

総合スコア11

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

メール

メールは、コンピュータネットワークを利用し、 情報等を交換する手段のことです。

0グッド

0クリップ

投稿2018/08/21 14:30

編集2018/08/21 15:50

イメージ説明

エラーメッセージ

Devise::Mailer#reset_password_instructions: processed outbound mail in 1652.5ms Sent mail to to@gmail.com (829.3ms) Date: Tue, 21 Aug 2018 23:21:53 +0900 From: gmail@gmail.com Reply-To: gmail@gmail.com To: to@gmail.com Message-ID: <5b7c200177d33_f7633XXXXXXXXXXXXXXX@userAir.mail> Subject: =?UTF-8?Q?=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89=E3=81=AE=E5=86=8D=E8=A8=AD=E5=AE=9A=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6?= Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p>=E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF=EF=BC=81=E7=AE=A1=E7=90=86= =E4=BA=BA=E3=81=AE=E3=81=94=E3=81=84=E3=81=A7=E3=81=99( =CB=98=CF=89=CB=98= )</p> <p>Someone has requested a link to change your password. You can do this = through the link below.</p> <p><a href=3D"http://localhost:3000/users/password/edit?reset_password_to= ken=3DV-vPcs3UL-8VGzQe4s_y">=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89= =E5=A4=89=E6=9B=B4</a></p> <p>If you didn't request this, please ignore this email.</p> <p>Your password won't change until you access the link above and create = a new one.</p> Completed 500 Internal Server Error in 3737ms (ActiveRecord: 10.2ms) EOFError (end of file reached):

概要
Devise gem のメール発信で起きるエラーです。
※以前までは発信できていました。

・エラー発生は開発環境(localhost:3000)
・SMTP:gmail

心当たり
development.rbの設定をいじいじしたのが原因かと思います。
(確証もなくいじいじしてしまい反省しています)

何か問題・気づき・アドバイス等ありましたらよろしくお願いいたします。

Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker # mailer setting # mailer setting config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :enable_starttls_auto => true, :address => "smtp.gmail.com", :port => 587, :domain => ENV['gmail_dmain'], :user_name => ENV['gmail_username'], :password => ENV['gmail_password'], :authentication => 'login' } end

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

config.action_mailer.smtp_settings = {
~
:domain => ENV['gmail_dmain'],
~
}

ドメイン名に問題があると同様の結果になるようです。
Devise mailer EOF error

リンク中の下記辺りが今回の原因に該当する内容な気がします。

My config/secrets.yml isn't tracked in git (naturally) and looks like it was overwritten and lost those entries for the email provider smtp/username/password at some point.

僕も以前作成したアプリでdeviseを絡めたメール送信を行なっていたので書いておきます。

config.action_mailer.default_url_options = { host: "localhost:3000"} config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :user_name => ENV['MAIL_ADDRESS'], :password => ENV['MAIL_PASSWORD'], :authentication => :plain, :enable_starttls_auto => true } config.action_mailer.perform_caching = false

細々したところに差異がありますが、:domainを設定せずとも動いていました。
設定する必要があるのであれば、別のドメイン名を試してみてください。

Don't care if the mailer can't send.

config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false

質問とは関係ないですが、この辺りの設定が重複しています。

投稿2018/08/22 03:54

編集2018/08/22 04:17
退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Goi

2018/08/22 06:03

ぶたさん、回答ありがとうございます! domainが原因なのですね。 いただいたアドバイス試してみます。 また、重複内容の指摘ありがとうございます。見落とさないよう精進します…
guest

0

当方が解決できるかどうかは分かりませんが、とりあえず具体的なエラーの内容について記載した方が情報が得られるかと思います。

投稿2018/08/21 14:55

psuke

総合スコア202

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Goi

2018/08/21 15:51

申し訳ありません。。 載せた気になって勘違いしていました。 早速、用意していた画像とともにエラーメッセージも用意しました。 ご指摘ありがとうございます。
退会済みユーザー

退会済みユーザー

2018/08/22 03:59

回答ではないので、ここではなく「追記・修正依頼」のところに書いてください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問