由heroku部署时,生产中会出现错误500

时间:2019-01-16 14:58:02

标签: ruby-on-rails heroku

请帮帮我。出现此错误“很抱歉,出了点问题。 如果您是应用程序所有者,请在我部署到heroku时检查日志以获取更多信息。但是在本地运行良好 我也尝试这样做  https://i.stack.imgur.com/pQJS0.jpg 但这对我没有帮助 问题是当我以新用户身份登录时(这是Rails教程)。这是一些日志

b1

这是运行命令heroku logs --tail

之后的代码

添加主机值后,出现以下错误:

     heroku logs --tail
    2019-01-16T13:16:01.590786+00:00 app[web.1]: [fd635b17-afbe-46dc-96f0-619bbf8f11e7]      9: <%= link_to "Activate", edit_account_activation_url(@user.activation_token,
    2019-01-16T13:16:01.590787+00:00 app[web.1]: [fd635b17-afbe-46dc-96f0-619bbf8f11e7]     10:                                                     email: @user.email) %>
    2019-01-16T13:16:01.590852+00:00 app[web.1]: F, [2019-01-16T13:16:01.590783 #4] FATAL -- : [fd635b17-afbe-46dc-96f0-619bbf8f11e7]
    2019-01-16T13:16:01.590901+00:00 app[web.1]: F, [2019-01-16T13:16:01.590857 #4] FATAL -- : [fd635b17-afbe-46dc-96f0-619bbf8f11e7] app/views/user_mailer/account_activation.html.erb:9:in `_app_views_user_mailer_account_activation_html_erb___51652882317290060_70044044082940'
    2019-01-16T13:16:01.590903+00:00 app[web.1]: [fd635b17-afbe-46dc-96f0-619bbf8f11e7] app/mailers/user_mailer.rb:10:in `account_activation'
    2019-01-16T13:16:01.590905+00:00 app[web.1]: [fd635b17-afbe-46dc-96f0-619bbf8f11e7] app/controllers/users_controller.rb:21:in `create'
    2019-01-16T13:51:01.604733+00:00 heroku[web.1]: Idling
    2019-01-16T13:51:01.608754+00:00 heroku[web.1]: State changed from up to down
    2019-01-16T14:50:38.084642+00:00 heroku[web.1]: State changed from down to starting
    2019-01-16T14:50:41.934933+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
    2019-01-16T14:50:47.596849+00:00 app[web.1]: * Listening on tcp://0.0.0.0:25122
    2019-01-16T14:50:47.597604+00:00 app[web.1]: Use Ctrl-C to stop
    2019-01-16T14:50:48.311163+00:00 heroku[web.1]: State changed from starting to up
    2019-01-16T14:50:50.157432+00:00 app[web.1]: I, [2019-01-16T14:50:50.157329 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550] Started GET "/" for 194.44.208.54 at 2019-01-16 14:50:50 +0000
    2019-01-16T14:50:50.158279+00:00 app[web.1]: I, [2019-01-16T14:50:50.158206 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550] Processing by StaticPagesController#home as HTML
    2019-01-16T14:50:50.159174+00:00 app[web.1]: I, [2019-01-16T14:50:50.159106 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendering static_pages/home.html.erb within layouts/application
    2019-01-16T14:50:50.159706+00:00 app[web.1]: I, [2019-01-16T14:50:50.159645 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendered static_pages/home.html.erb within layouts/application (0.4ms)
    2019-01-16T14:50:50.160648+00:00 app[web.1]: I, [2019-01-16T14:50:50.160585 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendered layouts/_rails_default.html.erb (0.7ms)
    2019-01-16T14:50:50.160837+00:00 app[web.1]: I, [2019-01-16T14:50:50.160776 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendered layouts/_shim.html.erb (0.0ms)
    2019-01-16T14:50:50.161274+00:00 app[web.1]: I, [2019-01-16T14:50:50.161209 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendered layouts/_header.html.erb (0.3ms)
    2019-01-16T14:50:50.164178+00:00 app[web.1]: I, [2019-01-16T14:50:50.161509 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550]   Rendered layouts/_footer.html.erb (0.1ms)
    2019-01-16T14:50:50.164181+00:00 app[web.1]: I, [2019-01-16T14:50:50.161753 #4]  INFO -- : [c9b34a35-d1cd-4de0-8d94-dd785bc68550] Completed 200 OK in 3ms (Views: 2.8ms)
    2019-01-16T14:50:55.285534+00:00 app[web.1]: I, [2019-01-16T14:50:55.285435 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30] Started GET "/signup" for 194.44.208.54 at 2019-01-16 14:50:55 +0000
    2019-01-16T14:50:55.286488+00:00 app[web.1]: I, [2019-01-16T14:50:55.286416 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30] Processing by UsersController#new as HTML
    2019-01-16T14:50:55.438699+00:00 app[web.1]: I, [2019-01-16T14:50:55.438577 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendering users/new.html.erb within layouts/application
    2019-01-16T14:50:55.445021+00:00 app[web.1]: I, [2019-01-16T14:50:55.442522 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered shared/_error_messages.html.erb (0.4ms)
    2019-01-16T14:50:56.192013+00:00 app[web.1]: I, [2019-01-16T14:50:56.191893 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered users/_form.html.erb (752.3ms)
    2019-01-16T14:50:56.192199+00:00 app[web.1]: I, [2019-01-16T14:50:56.192115 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered users/new.html.erb within layouts/application (753.4ms)
    2019-01-16T14:50:56.192980+00:00 app[web.1]: I, [2019-01-16T14:50:56.192900 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered layouts/_rails_default.html.erb (0.5ms)
    2019-01-16T14:50:56.193154+00:00 app[web.1]: I, [2019-01-16T14:50:56.193093 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered layouts/_shim.html.erb (0.0ms)
    2019-01-16T14:50:56.193560+00:00 app[web.1]: I, [2019-01-16T14:50:56.193498 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered layouts/_header.html.erb (0.3ms)
    2019-01-16T14:50:56.193869+00:00 app[web.1]: I, [2019-01-16T14:50:56.193808 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30]   Rendered layouts/_footer.html.erb (0.1ms)
    2019-01-16T14:50:56.194186+00:00 app[web.1]: I, [2019-01-16T14:50:56.194120 #4]  INFO -- : [f148e8a0-1283-47d8-9cfd-13d9dfa45c30] Completed 200 OK in 908ms (Views: 756.3ms | ActiveRecord: 69.5ms)
 C19-01-16T15:05:06.429588 #4]  INFO -- : [ee8dfcc8-f9e6-4b88-b34c-76981b3c818d] Completed 200 OK in 22ms (Views: 20.6ms)
    2019-01-16T15:37:24.694353+00:00 heroku[web.1]: State changed from up to down
    2019-01-16T15:37:26.307531+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2019-01-16T15:37:26.458187+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
    2019-01-16T15:37:26.481651+00:00 app[web.1]: === puma shutdown: 2019-01-16 15:37:26 +0000 ===
    2019-01-16T15:37:26.482088+00:00 app[web.1]: - Goodbye!
    2:184:in `run'
    2019-01-16T15:37:26.482808+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/cli.rb:78:in `run'
    2019-01-16T15:37:26.482810+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/bin/puma:10:in `<top (required)>'
    2019-01-16T15:37:26.482811+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/bin/puma:23:in `load'
    2019-01-16T15:37:26.482813+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/bin/puma:23:in `<top (required)>'
    2019-01-16T16:08:11.826631+00:00 heroku[web.1]: State changed from down to starting
    2019-01-16T16:08:19.763046+00:00 app[web.1]: Puma starting in single mode...
    2019-01-16T16:08:19.763079+00:00 app[web.1]: * Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas
    2019-01-16T16:08:19.763081+00:00 app[web.1]: * Min threads: 5, max threads: 5
    2019-01-16T16:08:19.763083+00:00 app[web.1]: * Environment: production
    2019-01-16T16:08:25.437415+00:00 app[web.1]: * Listening on tcp://0.0.0.0:5013
    2019-01-16T16:08:25.437840+00:00 app[web.1]: Use Ctrl-C to stop
    2019-01-16T16:08:25.845703+00:00 heroku[web.1]: State changed from starting to up
    2019-01-16T16:08:27.912870+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=calm-spire-36002.herokuapp.com request_id=fed2543d-a7b5-448c-acd6-94dd896daa16 fwd="194.44.208.54" dyno=web.1 connect=1ms service=3ms status=304 bytes=112 protocol=https
    2019-01-16T16:08:28.600223+00:00 app[web.1]: I, [2019-01-16T16:08:28.600079 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendering users/new.html.erb within layouts/application
    2019-01-16T16:08:28.605740+00:00 app[web.1]: I, [2019-01-16T16:08:28.605661 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered shared/_error_messages.html.erb (0.6ms)
    2019-01-16T16:08:29.480045+00:00 heroku[router]: at=info method=GET path="/signup" host=calm-spire-36002.herokuapp.com request_id=cd923035-45c6-4c11-869f-7a1265130075 fwd="194.44.208.54" dyno=web.1 connect=0ms service=1476ms status=200 bytes=3472 protocol=https
    2019-01-16T16:08:29.465380+00:00 app[web.1]: I, [2019-01-16T16:08:29.465241 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered users/_form.html.erb (863.6ms)
    2019-01-16T16:08:29.465481+00:00 app[web.1]: I, [2019-01-16T16:08:29.465410 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered users/new.html.erb within layouts/application (865.2ms)
    2019-01-16T16:08:29.468773+00:00 app[web.1]: I, [2019-01-16T16:08:29.468694 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered layouts/_rails_default.html.erb (1.6ms)
    2019-01-16T16:08:29.469749+00:00 app[web.1]: I, [2019-01-16T16:08:29.469673 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered layouts/_shim.html.erb (0.3ms)
    2019-01-16T16:08:29.475476+00:00 app[web.1]: I, [2019-01-16T16:08:29.475398 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered layouts/_header.html.erb (5.0ms)
    2019-01-16T16:08:29.476851+00:00 app[web.1]: I, [2019-01-16T16:08:29.476777 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075]   Rendered layouts/_footer.html.erb (0.6ms)
    2019-01-16T16:08:29.477240+00:00 app[web.1]: I, [2019-01-16T16:08:29.477173 #4]  INFO -- : [cd923035-45c6-4c11-869f-7a1265130075] Completed 200 OK in 1469ms (Views: 879.1ms | ActiveRecord: 505.5ms)
    2019-01-16T16:09:24.694871+00:00 app[web.1]: I, [2019-01-16T16:09:24.693260 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] Started POST "/users" for 194.44.208.54 at 2019-01-16 16:09:24 +0000
    2019-01-16T16:09:24.694882+00:00 app[web.1]: I, [2019-01-16T16:09:24.694541 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] Processing by UsersController#create as HTML
    2019-01-16T16:09:24.694887+00:00 app[web.1]: I, [2019-01-16T16:09:24.694634 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"8H+A3e7TtDvzCvHdRt1wOuXxDGo4UmHnhAFOixiN2AqZ0lKcY4OG+gScKmlRc31nGZIT0bPYIBQckWRIcTWpcw==", "user"=>{"name"=>"aaaa", "email"=>"aaaas@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
    2019-01-16T16:09:24.841768+00:00 app[web.1]: D, [2019-01-16T16:09:24.841665 #4] DEBUG -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]    (1.1ms)  BEGIN
    2019-01-16T16:09:24.988238+00:00 app[web.1]: D, [2019-01-16T16:09:24.988127 #4] DEBUG -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]   User Exists (65.7ms)  SELECT  1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER($1) LIMIT $2  [["email", "aaaas@gmail.com"], ["LIMIT", 1]]
    2019-01-16T16:09:25.170744+00:00 app[web.1]: D, [2019-01-16T16:09:25.170598 #4] DEBUG -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]   User Create (22.4ms)  INSERT INTO "users" ("name", "email", "created_at", "updated_at", "password_digest", "activation_digest") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"  [["name", "aaaa"], ["email", "aaaas@gmail.com"], ["created_at", "2019-01-16 16:09:24.988622"], ["updated_at", "2019-01-16 16:09:24.988622"], ["password_digest", "$2a$10$oy5pyDRqTwem3GGBR.ZdnO4779IYLCFxUyRadgRefLVm3PdtVpeNW"], ["activation_digest", "$2a$10$nxGhsXHK/q/UOoj5YG50meivBK/kD.aCF7HiRgn1H72X9NzegKokm"]]
    2019-01-16T16:09:25.173673+00:00 app[web.1]: D, [2019-01-16T16:09:25.173575 #4] DEBUG -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]    (2.4ms)  COMMIT
    2019-01-16T16:09:25.185053+00:00 app[web.1]: I, [2019-01-16T16:09:25.184951 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]   Rendering user_mailer/account_activation.html.erb within layouts/mailer
    2019-01-16T16:09:25.187573+00:00 app[web.1]: I, [2019-01-16T16:09:25.187499 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]   Rendered user_mailer/account_activation.html.erb within layouts/mailer (2.4ms)
    2019-01-16T16:09:25.187728+00:00 app[web.1]: D, [2019-01-16T16:09:25.187654 #4] DEBUG -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] UserMailer#account_activation: processed outbound mail in 13.6ms
    2019-01-16T16:09:25.190341+00:00 app[web.1]: I, [2019-01-16T16:09:25.190287 #4]  INFO -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] Completed 500 Internal Server Error in 495ms (ActiveRecord: 167.8ms)
    2019-01-16T16:09:25.191554+00:00 app[web.1]: F, [2019-01-16T16:09:25.191464 #4] FATAL -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]
    2019-01-16T16:09:25.191619+00:00 app[web.1]: F, [2019-01-16T16:09:25.191560 #4] FATAL -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
    2019-01-16T16:09:25.191856+00:00 app[web.1]: F, [2019-01-16T16:09:25.191763 #4] FATAL -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]      6: Welcome to the Sample App! Click on the link below to activate your account:
    2019-01-16T16:09:25.191860+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51]      7: </p>
    2019-01-16T16:09:25.191863+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51]      8:
    2019-01-16T16:09:25.191865+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51]      9: <%= link_to "Activate", edit_account_activation_url(@user.activation_token,
    2019-01-16T16:09:25.191867+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51]     10:                                                     email: @user.email) %>
    2019-01-16T16:09:25.191983+00:00 app[web.1]: F, [2019-01-16T16:09:25.191857 #4] FATAL -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51]
    2019-01-16T16:09:25.192053+00:00 app[web.1]: F, [2019-01-16T16:09:25.191986 #4] FATAL -- : [06a105d0-fbb7-4184-86d4-8cc55010ec51] app/views/user_mailer/account_activation.html.erb:9:in `_app_views_user_mailer_account_activation_html_erb__3781546992025811969_70102224775860'
    2019-01-16T16:09:25.192055+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51] app/mailers/user_mailer.rb:10:in `account_activation'
    2019-01-16T16:09:25.192056+00:00 app[web.1]: [06a105d0-fbb7-4184-86d4-8cc55010ec51] app/controllers/users_controller.rb:21:in `create'
    2019-01-16T16:09:25.193461+00:00 heroku[router]: at=info method=POST path="/users" host=calm-spire-36002.herokuapp.com request_id=06a105d0-fbb7-4184-86d4-8cc55010ec51 fwd="194.44.208.54" dyno=web.1 connect=0ms service=513ms status=500 bytes=1891 protocol=https

1 个答案:

答案 0 :(得分:0)

错误消息指出:

2019-01-16T14:52:25.691412+00:00 app[web.1]: F, [2019-01-16T14:52:25.691344 #4] FATAL -- : [4a832d9c-6928-438c-acbc-abb1d09269ba] 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,production.rb)。

关于另一则帖子的示例: How to set config.action_controller.default_url_options = {:host = '#''} on per environment basis