前提・実現したいこと
railsチュートリアルの11章(認証メール送信機能の実装)リンク内容の最後にherokuへデプロイし、本番環境でsign upして認証メールを送信しようと試みましたが下記エラーメッセージが出て失敗しました。
開発環境では全てのテストは通っており、設定もチュートリアルどおりに出来ているはずなのですが、どこに問題があるのか見当がつきません。
どのように解決すればよいでしょうか。
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. 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.seconds.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :test host = 'https://evening-ridge-47211.herokuapp.com/' # ここをコピペすると失敗します。自分の環境に合わせてください。 config.action_mailer.default_url_options = { host: host } ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_PASSWORD'], :domain => 'heroku.com', :enable_starttls_auto => true } 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 # 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 end
Heroku logs
2019-11-20T12:20:08.744164+00:00 app[web.1]: I, [2019-11-20T12:20:08.744091 #4] INFO -- : [f52d78bb-0df1-44a6-b935-ea15e8c0c161] Completed 500 Internal Server Error in 194ms (ActiveRecord: 12.6ms) 2019-11-20T12:20:08.745390+00:00 app[web.1]: F, [2019-11-20T12:20:08.745314 #4] FATAL -- : [f52d78bb-0df1-44a6-b935-ea15e8c0c161] 2019-11-20T12:20:08.745542+00:00 app[web.1]: F, [2019-11-20T12:20:08.745460 #4] FATAL -- : [f52d78bb-0df1-44a6-b935-ea15e8c0c161] ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
試したこと
herokuのデータベースをリセットし、サイド作成し直して見ましたが結果は同じでした。
補足情報(FW/ツールのバージョンなど)
AWS Cloud9
Heroku
回答1件
あなたの回答
tips
プレビュー