мое приложение работает на локальном хосте, его форма отправляется по электронной почте после отправки. Однако при развертывании на heroku форма показывается, но когда я нажимаю «Отправить», она выдает ошибку.
Приносим извинения, но что-то пошло не так. Если вы владелец приложения, проверьте журналы для получения дополнительной информации.
Я попытался настроить Heroku: установить GMAIL_USERNAME, настроить Heroku: установить ПАРОЛЬ
Я попытался запустить Heroku rails db: migrate
когда я вижу журналы, эти вещи выделяются:
внутренняя ошибка сервера 500 и
Net :: SMTPAuthenticationError (530-5.5.1) Требуется аутентификация
Я застрял ...
Production.rb
config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: "positionupdate.herokuapp.com" }
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: 'gmail.com',
user_name: "******@gmail.com",
password: "******",
authentication: :plain,
enable_starttls_auto: true
}
controller
class PositionsController < ApplicationController
def new
@position = Position.new
end
def show
@position = Position.find(params[:id])
end
def create
@position = Position.new(position_params)
if @position.save!
# redirect_to @position
PositionMailer.general_message(@position).deliver
else
render :new
end
end
private def position_params
params.require(:position).permit(:date, :time, :activity, :tripnumber)
end
end
mailer
class PositionMailer < ActionMailer::Base
default from: "bargeplanner@gmail.com"
layout 'mailer'
def general_message(position)
@position = position
mail(:to => "sebastiaankosman@gmail.com", :subject => "You Have a Message From Your Website")
end
end
ЛОГИ ГЕРОКУ
heroku logs
2019-10-24T13:02:17.216794+00:00 app[api]: Release v12 created by user XXXXX@gmail.com
2019-10-24T13:02:19.083981+00:00 heroku[web.1]: Restarting
2019-10-24T13:02:19.116881+00:00 heroku[web.1]: State changed from up to starting
2019-10-24T13:02:19.986003+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-10-24T13:02:20.030355+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2019-10-24T13:02:20.031099+00:00 app[web.1]: === puma shutdown: 2019-10-24 13:02:20 +0000 ===
2019-10-24T13:02:20.031104+00:00 app[web.1]: - Goodbye!
2019-10-24T13:02:20.13329+00:00 heroku[web.1]: Process exited with status 143
2019-10-24T13:02:27.906187+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2019-10-24T13:02:26+00:00 app[api]: Build succeeded
2019-10-24T13:02:31.09745+00:00 app[web.1]: Puma starting in single mode...
2019-10-24T13:02:31.097472+00:00 app[web.1]: * Version 4.2.1 (ruby 2.6.3-p62), codename: Distant Airhorns
2019-10-24T13:02:31.097474+00:00 app[web.1]: * Min threads: 5, max threads: 5
2019-10-24T13:02:31.097475+00:00 app[web.1]: * Environment: production
2019-10-24T13:02:35.721678+00:00 app[web.1]: * Listening on tcp://0.0.0.0:57175
2019-10-24T13:02:35.721871+00:00 app[web.1]: Use Ctrl-C to stop
2019-10-24T13:02:36.218765+00:00 heroku[web.1]: State changed from starting to up
2019-10-24T13:04:46.829073+00:00 app[web.1]: I, [2019-10-24T13:04:46.828970 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Started GET "/" for 109.38.132.207 at 2019-10-24 13:04:46 +0000
2019-10-24T13:04:46.83093+00:00 app[web.1]: I, [2019-10-24T13:04:46.830854 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Processing by PositionsController#new as HTML
2019-10-24T13:04:46.894657+00:00 app[web.1]: I, [2019-10-24T13:04:46.894554 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Rendering positions/new.html.erb within layouts/application
2019-10-24T13:04:46.948941+00:00 app[web.1]: I, [2019-10-24T13:04:46.948826 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Rendered positions/new.html.erb within layouts/application (54.1ms)
2019-10-24T13:04:46.951115+00:00 app[web.1]: I, [2019-10-24T13:04:46.951032 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Rendered shared/_navbar.html.erb (0.3ms)
2019-10-24T13:04:46.951508+00:00 app[web.1]: I, [2019-10-24T13:04:46.951438 #4] INFO -- : [9224a361-9e91-49eb-9660-1c06baeb23bd] Completed 200 OK in 120ms (Views: 59.1ms | ActiveRecord: 15.1ms)
2019-10-24T13:04:46.958566+00:00 heroku[router]: at=info method=GET path="/" host=www.bargeplanner.com request_id=9224a361-9e91-49eb-9660-1c06baeb23bd fwd="109.38.132.207" dyno=web.1 connect=1ms service=129ms status=200 bytes=3984 protocol=http
2019-10-24T13:04:55.652246+00:00 app[web.1]: I, [2019-10-24T13:04:55.652142 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Started POST "/positions" for 109.38.132.207 at 2019-10-24 13:04:55 +0000
2019-10-24T13:04:55.65376+00:00 app[web.1]: I, [2019-10-24T13:04:55.653686 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Processing by PositionsController#create as HTML
2019-10-24T13:04:55.653929+00:00 app[web.1]: I, [2019-10-24T13:04:55.653864 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Parameters: {"utf8"=>"✓", "authenticity_token"=>"JHOD0ghzmXA/kOu4Hz3jCf2GbwW7G1VwLYmmCRN+BjL4ch/oUmA50pAvaTJcxdmWL5XpBsq+v7QuJMjUGaBTpg==", "position"=>{"tripnumber"=>"71344", "activity"=>"Sailing to loadport, expected arrival", "date"=>"2019-10-10", "time"=>""}, "commit"=>"Send update"}
2019-10-24T13:04:55.658399+00:00 app[web.1]: D, [2019-10-24T13:04:55.658325 #4] DEBUG -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] (0.6ms) BEGIN
2019-10-24T13:04:55.662938+00:00 app[web.1]: D, [2019-10-24T13:04:55.662793 #4] DEBUG -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Position Create (1.7ms) INSERT INTO "positions" ("tripnumber", "activity", "date", "time", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["tripnumber", "71344"], ["activity", "Sailing to loadport, expected arrival"], ["date", "2019-10-10"], ["time", ""], ["created_at", "2019-10-24 13:04:55.658922"], ["updated_at", "2019-10-24 13:04:55.658922"]]
2019-10-24T13:04:55.668549+00:00 app[web.1]: D, [2019-10-24T13:04:55.668457 #4] DEBUG -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] (5.0ms) COMMIT
2019-10-24T13:04:55.675392+00:00 app[web.1]: I, [2019-10-24T13:04:55.675292 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Rendering position_mailer/general_message.html.erb within layouts/mailer
2019-10-24T13:04:55.676271+00:00 app[web.1]: I, [2019-10-24T13:04:55.676198 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Rendered position_mailer/general_message.html.erb within layouts/mailer (0.7ms)
2019-10-24T13:04:55.677492+00:00 app[web.1]: D, [2019-10-24T13:04:55.677428 #4] DEBUG -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] PositionMailer#general_message: processed outbound mail in 8.3ms
2019-10-24T13:04:55.862125+00:00 app[web.1]: I, [2019-10-24T13:04:55.861986 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Sent mail to XXXXXX@gmail.com (184.2ms)
2019-10-24T13:04:55.862351+00:00 app[web.1]: D, [2019-10-24T13:04:55.862122 #4] DEBUG -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Date: Thu, 24 Oct 2019 13:04:55 +0000
2019-10-24T13:04:55.862354+00:00 app[web.1]: From: bargeplanner@gmail.com
2019-10-24T13:04:55.862355+00:00 app[web.1]: To: XXXXX@gmail.com
2019-10-24T13:04:55.862359+00:00 app[web.1]: Message-ID: <5db1a177a5b8a_42abfda7f0f0c848b0@b398225d-8afb-45f2-9a44-df41e37035fd.mail>
2019-10-24T13:04:55.862361+00:00 app[web.1]: Subject: You Have a Message From Your Website
2019-10-24T13:04:55.862362+00:00 app[web.1]: Mime-Version: 1.0
2019-10-24T13:04:55.862363+00:00 app[web.1]: Content-Type: text/html;
2019-10-24T13:04:55.862365+00:00 app[web.1]: charset=UTF-8
2019-10-24T13:04:55.862366+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2019-10-24T13:04:55.862368+00:00 app[web.1]:
2019-10-24T13:04:55.862369+00:00 app[web.1]: <!DOCTYPE html>
2019-10-24T13:04:55.862371+00:00 app[web.1]: <html>
2019-10-24T13:04:55.862372+00:00 app[web.1]: <head>
2019-10-24T13:04:55.862375+00:00 app[web.1]: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2019-10-24T13:04:55.862376+00:00 app[web.1]: <style>
2019-10-24T13:04:55.862377+00:00 app[web.1]: /* Email styles need to be inline */
2019-10-24T13:04:55.862378+00:00 app[web.1]: </style>
2019-10-24T13:04:55.86238+00:00 app[web.1]: </head>
2019-10-24T13:04:55.862381+00:00 app[web.1]:
2019-10-24T13:04:55.862383+00:00 app[web.1]: <body>
2019-10-24T13:04:55.862384+00:00 app[web.1]: 71344
2019-10-24T13:04:55.862385+00:00 app[web.1]: Sailing to loadport, expected arrival
2019-10-24T13:04:55.862387+00:00 app[web.1]: 2019-10-10
2019-10-24T13:04:55.862388+00:00 app[web.1]:
2019-10-24T13:04:55.862389+00:00 app[web.1]:
2019-10-24T13:04:55.86239+00:00 app[web.1]:
2019-10-24T13:04:55.862392+00:00 app[web.1]:
2019-10-24T13:04:55.862393+00:00 app[web.1]: </body>
2019-10-24T13:04:55.862394+00:00 app[web.1]: </html>
2019-10-24T13:04:55.862395+00:00 app[web.1]:
2019-10-24T13:04:55.87534+00:00 app[web.1]: I, [2019-10-24T13:04:55.875043 #4] INFO -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Completed 500 Internal Server Error in 209ms (ActiveRecord: 7.3ms)
2019-10-24T13:04:55.876614+00:00 app[web.1]: F, [2019-10-24T13:04:55.876528 #4] FATAL -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9]
2019-10-24T13:04:55.876797+00:00 app[web.1]: F, [2019-10-24T13:04:55.876713 #4] FATAL -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] Net::SMTPAuthenticationError (530-5.5.1 Authentication Required. Learn more at
2019-10-24T13:04:55.876799+00:00 app[web.1]: ):
2019-10-24T13:04:55.876872+00:00 app[web.1]: F, [2019-10-24T13:04:55.876797 #4] FATAL -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9]
2019-10-24T13:04:55.877014+00:00 app[web.1]: F, [2019-10-24T13:04:55.876895 #4] FATAL -- : [3c702e4e-255f-44fc-896f-da0cc9b11cb9] app/controllers/positions_controller.rb:16:in `create'
2019-10-24T13:04:55.885119+00:00 heroku[router]: at=info method=POST path="/positions" host=www.bargeplanner.com request_id=3c702e4e-255f-44fc-896f-da0cc9b11cb9 fwd="109.38.132.207" dyno=web.1 connect=0ms service=237ms status=500 bytes=1827 protocol=http
2019-10-24T14:41:03.279438+00:00 heroku[router]: at=info method=GET path="/" host=www.bargeplanner.com request_id=af279606-e8ab-4743-8756-c57c220361f3 fwd="134.146.254.71,185.46.213.78" dyno=web.1 connect=1ms service=10ms status=200 bytes=3986 protocol=http
2019-10-24T14:41:03.267726+00:00 app[web.1]: I, [2019-10-24T14:41:03.267616 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Started GET "/" for 185.46.213.78 at 2019-10-24 14:41:03 +0000
2019-10-24T14:41:03.268765+00:00 app[web.1]: I, [2019-10-24T14:41:03.268694 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Processing by PositionsController#new as HTML
2019-10-24T14:41:03.26948+00:00 app[web.1]: I, [2019-10-24T14:41:03.269421 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Rendering positions/new.html.erb within layouts/application
2019-10-24T14:41:03.272541+00:00 app[web.1]: I, [2019-10-24T14:41:03.272477 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Rendered positions/new.html.erb within layouts/application (3.0ms)
2019-10-24T14:41:03.273295+00:00 app[web.1]: I, [2019-10-24T14:41:03.273237 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Rendered shared/_navbar.html.erb (0.0ms)
2019-10-24T14:41:03.273509+00:00 app[web.1]: I, [2019-10-24T14:41:03.273455 #4] INFO -- : [af279606-e8ab-4743-8756-c57c220361f3] Completed 200 OK in 5ms (Views: 4.3ms)
2019-10-24T14:41:03.448804+00:00 heroku[router]: at=info method=GET path="/assets/application-0b00730ef56cf98168ed7be2f8ae4709bb9f6261f36c4c966ccfa68c3a2f9db1.js" host=www.bargeplanner.com request_id=92933c8a-c76a-4ad6-a641-ddd46c9c0729 fwd="134.146.254.71,185.46.213.78" dyno=web.1 connect=0ms service=2ms status=200 bytes=6913 protocol=http
2019-10-24T14:41:03.458484+00:00 heroku[router]: at=info method=GET path="/packs/js/application-1efd28d5d72da98d48f0.js" host=www.bargeplanner.com request_id=d8df8eae-a083-4653-8b06-19f5edada9a4 fwd="134.146.254.71,185.46.213.78" dyno=web.1 connect=0ms service=5ms status=200 bytes=52797 protocol=http
2019-10-24T14:41:03.425762+00:00 heroku[router]: at=info method=GET path="/assets/application-00ffe2847ddf9d8dde429984523e7525abf41c4f9516ee8823c340d885fdb6a7.css" host=www.bargeplanner.com request_id=655204e7-7227-4b9e-a7e8-29c71f3a2c80 fwd="134.146.254.71,185.46.213.78" dyno=web.1 connect=1ms service=6ms status=200 bytes=35676 protocol=http
2019-10-24T14:41:04.11728+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=www.bargeplanner.com request_id=7cda8ac8-af65-4cb3-85e9-14da67e36714 fwd="134.146.254.71,185.46.213.78" dyno=web.1 connect=0ms service=3ms status=200 bytes=143 protocol=http
2019-10-24T14:41:07.71321+00:00 app[web.1]: I, [2019-10-24T14:41:07.713085 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Started POST "/positions" for 185.46.213.78 at 2019-10-24 14:41:07 +0000
2019-10-24T14:41:07.714339+00:00 app[web.1]: I, [2019-10-24T14:41:07.714255 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Processing by PositionsController#create as HTML
2019-10-24T14:41:07.714459+00:00 app[web.1]: I, [2019-10-24T14:41:07.714381 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Parameters: {"utf8"=>"✓", "authenticity_token"=>"NKSoAAd6h3KtBqwef1ugNf9Jar8IjOKQnmtabKeaQhtt+8K8XlQb1drP/98BsXDZRrsixe1FNHDx2j2D/AWkMw==", "position"=>{"tripnumber"=>"", "activity"=>"", "date"=>"", "time"=>""}, "commit"=>"Send update"}
2019-10-24T14:41:07.740784+00:00 app[web.1]: D, [2019-10-24T14:41:07.740694 #4] DEBUG -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] (0.5ms) BEGIN
2019-10-24T14:41:07.743225+00:00 app[web.1]: D, [2019-10-24T14:41:07.743126 #4] DEBUG -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Position Create (1.1ms) INSERT INTO "positions" ("tripnumber", "activity", "date", "time", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["tripnumber", ""], ["activity", ""], ["date", ""], ["time", ""], ["created_at", "2019-10-24 14:41:07.740947"], ["updated_at", "2019-10-24 14:41:07.740947"]]
2019-10-24T14:41:07.78659+00:00 app[web.1]: D, [2019-10-24T14:41:07.786436 #4] DEBUG -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] (42.9ms) COMMIT
2019-10-24T14:41:07.787951+00:00 app[web.1]: I, [2019-10-24T14:41:07.787884 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Rendering position_mailer/general_message.html.erb within layouts/mailer
2019-10-24T14:41:07.788237+00:00 app[web.1]: I, [2019-10-24T14:41:07.788150 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Rendered position_mailer/general_message.html.erb within layouts/mailer (0.1ms)
2019-10-24T14:41:07.788969+00:00 app[web.1]: D, [2019-10-24T14:41:07.788900 #4] DEBUG -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] PositionMailer#general_message: processed outbound mail in 1.8ms
2019-10-24T14:41:07.944273+00:00 app[web.1]: I, [2019-10-24T14:41:07.944144 #4] INFO -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Sent mail to XXXXXn@gmail.com (155.0ms)
2019-10-24T14:41:07.944379+00:00 app[web.1]: D, [2019-10-24T14:41:07.944311 #4] DEBUG -- : [426141da-2811-4d42-aa3e-f16b31cc8c4f] Date: Thu, 24 Oct 2019 14:41:07 +0000
2019-10-24T14:41:07.944382+00:00 app[web.1]: From: bargeplanner@gmail.com
2019-10-24T14:41:07.944383+00:00 app[web.1]: To: XXXXXkosman@gmail.com
2019-10-24T14:41:07.944385+00:00 app[web.1]: Message-ID: <5db1b803c0d2e_42abfda7f0f0c84967@b398225d-8afb-45f2-9a44-df41e37035fd.mail>
2019-10-24T14:41:07.944387+00:00 app[web.1]: Subject: You Have a Message From Your Website
2019-10-24T14:41:07.944388+00:00 app[web.1]: Mime-Version: 1.0
2019-10-24T14:41:07.944389+00:00 app[web.1]: Content-Type: text/html;
2019-10-24T14:41:07.944391+00:00 app[web.1]: charset=UTF-8