1

I signed up on my rails app on heroku and get the following error on my heroku logs. Meanwhile, the user has been saved to the database.

Anyone with advise on how to proceed pls. I am using devise gem, tried both Puma and Thin servers. Still get the same error. App location is at: https://naijasinglesmeet.herokuapp.com

Sign up for an account and this is what I get in my logs below:

Please advise

2019-10-08T19:55:38.458871+00:00 app[web.1]: I, [2019-10-08T19:55:26.203972 #4]  INFO -- : [41600c35-8749-48f2-9c8a-8428f4a92dea] Completed 200 OK in 10ms (Views: 7.5ms | ActiveRecord: 0.0ms)
2019-10-08T19:55:38.458873+00:00 app[web.1]: I, [2019-10-08T19:55:38.298348 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] Started POST "/users" for 41.217.104.185 at 2019-10-08 19:55:38 +0000
2019-10-08T19:55:38.458875+00:00 app[web.1]: I, [2019-10-08T19:55:38.299628 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] Processing by RegistrationsController#create as HTML
2019-10-08T19:55:38.45889+00:00 app[web.1]: I, [2019-10-08T19:55:38.299753 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"amK9Wje7yZ2DJDtylpzVrY9HrYgc7pmtBMnbl/lrdU5/dW+A00CGgDAW8uAtyfiUDF0tvSZtCt56gOeZsmO+mA==", "user"=>{"username"=>"iamyinka", "first_name"=>"Yinka", "last_name"=>"Ash", "email"=>"iamhere@yinka.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
2019-10-08T19:55:38.458892+00:00 app[web.1]: D, [2019-10-08T19:55:38.458466 #4] DEBUG -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]    (0.7ms)  BEGIN
2019-10-08T19:55:38.993261+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=naijasinglesmeet.herokuapp.com request_id=6561ef3b-42df-48a4-a227-6d9aa163b5c9 fwd="41.217.104.185" dyno=web.1 connect=0ms service=1ms status=304 bytes=62 protocol=https
2019-10-08T19:55:41.320556+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#load_avg_1m=0.02
2019-10-08T19:55:41.348659+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#memory_total=79.79MB sample#memory_rss=79.75MB sample#memory_cache=0.04MB sample#memory_swap=0.00MB sample#memory_pgpgin=29231pages sample#memory_pgpgout=8805pages sample#memory_quota=512.00MB
2019-10-08T19:56:02.581435+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#load_avg_1m=0.01
2019-10-08T19:56:02.606547+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#memory_total=79.76MB sample#memory_rss=79.75MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=29231pages sample#memory_pgpgout=8813pages sample#memory_quota=512.00MB
2019-10-08T19:56:22.544894+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#load_avg_1m=0.01
2019-10-08T19:56:22.576747+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#memory_total=79.76MB sample#memory_rss=79.75MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=29231pages sample#memory_pgpgout=8813pages sample#memory_quota=512.00MB
2019-10-08T19:56:43.65213+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#load_avg_1m=0.01 sample#load_avg_5m=0.03
2019-10-08T19:56:43.68744+00:00 heroku[web.1]: source=web.1 dyno=heroku.148955966.114d5aad-5be9-43d4-9b68-1c16025c2349 sample#memory_total=79.76MB sample#memory_rss=79.75MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=29231pages sample#memory_pgpgout=8813pages sample#memory_quota=512.00MB


Hi guys.... Here's an update... finally, I see something come up...

2019-10-08T20:25:08.263845+00:00 app[web.1]: D, [2019-10-08T19:55:38.481415 #4] DEBUG -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]    (1.9ms)  COMMIT
2019-10-08T20:25:08.263848+00:00 app[web.1]: I, [2019-10-08T19:55:38.492062 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]   Rendering devise/mailer/confirmation_instructions.html.erb
2019-10-08T20:25:08.26385+00:00 app[web.1]: I, [2019-10-08T19:55:38.494157 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]   Rendered devise/mailer/confirmation_instructions.html.erb (2.0ms)
2019-10-08T20:25:08.263853+00:00 app[web.1]: D, [2019-10-08T19:55:38.494327 #4] DEBUG -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] Devise::Mailer#confirmation_instructions: processed outbound mail in 12.1ms
2019-10-08T20:25:08.263855+00:00 app[web.1]: I, [2019-10-08T19:55:38.494606 #4]  INFO -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] Completed 500 Internal Server Error in 195ms (ActiveRecord: 14.8ms)
2019-10-08T20:25:08.263857+00:00 app[web.1]: F, [2019-10-08T19:55:38.496369 #4] FATAL -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]
2019-10-08T20:25:08.26386+00:00 app[web.1]: F, [2019-10-08T19:55:38.496444 #4] FATAL -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] 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-10-08T20:25:08.263862+00:00 app[web.1]: F, [2019-10-08T19:55:38.496669 #4] FATAL -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]     2:
2019-10-08T20:25:08.263864+00:00 app[web.1]: [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]     3: <p>You can confirm your account email through the link below:</p>
2019-10-08T20:25:08.263866+00:00 app[web.1]: [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]     4:
2019-10-08T20:25:08.263867+00:00 app[web.1]: [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]     5: <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
2019-10-08T20:25:08.263869+00:00 app[web.1]: F, [2019-10-08T19:55:38.496775 #4] FATAL -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67]
2019-10-08T20:25:08.26387+00:00 app[web.1]: F, [2019-10-08T19:55:38.496845 #4] FATAL -- : [bf3b49db-ec4a-4bde-ae56-c5ae727b5f67] app/views/devise/mailer/confirmation_instructions.html.erb:5:in `_app_views_devise_mailer_confirmation_instructions_html_erb__3272380372352870108_47027054750980'
Yinka Ash
  • 13
  • 3
  • I do not see an error message in that log file. What exactly is your question? – spickermann Oct 08 '19 at 20:18
  • Exactly... no error message per say. The user is created but not redirected to the designated route. Yet it says "We're sorry, but something went wrong. If you are the application owner check the logs for more information." but no errors in the log file and all these memory data non-stop – Yinka Ash Oct 08 '19 at 20:22
  • Are you sure, there are no more lines in the log after what you just posted? And what are you getting if you run it locally on your computer? – Roland Studer Oct 08 '19 at 20:27
  • @RolandStuder - there are other lines of the same logs repeating infinitely – Yinka Ash Oct 08 '19 at 20:29
  • @YinkaAsh There must be some error in the logs, I clearly get a 500 application error response when I fill the form. Can you share/give access to the git repo? – Roland Studer Oct 08 '19 at 20:32
  • Ah, I see the problem now, easy to fix, will put it in the answer below. – Roland Studer Oct 08 '19 at 20:33
  • @RolandStuder - Finally something showed up. I just edited the main post. Please review. Thanks – Yinka Ash Oct 08 '19 at 20:33
  • @Yinka Ash You have put default mailer host. It seem that while sending mail through device, it can not find :host params. – Sanjiv Oct 08 '19 at 20:35
  • @yinkaAsh This should resolve your question. I will however vote to close your question as the way you phrased it is not helpful to others, if you had found the error message and searched for an answer you would have easily found something like: https://stackoverflow.com/questions/36131936/missing-host-to-link-to-please-provide-the-host-parameter-for-rails-4 . Don't let it discourage you, if your question gets deleted. The goal is to have good questions and answers that also help other people. Good luck! – Roland Studer Oct 08 '19 at 20:45
  • @RolandStuder Well, like I stated earlier, it actually didn't show the main error until way later... couple other people tried it. I really appreciate your help. Everything is fixed now. However, I setup the host in the environment.rb - Thank you – Yinka Ash Oct 08 '19 at 21:18
  • @YinkaAsh I am 100% sure the error was there before, you just didn't see it. It is hard to see them in the heroku logs. That's why I recommend using heroku logs --tail, or even better start using airbrake on heroku, then you will get errors by email with a detailed stacktrace – Roland Studer Oct 09 '19 at 08:07

1 Answers1

2

The relevant part of the error message is the following:

[2019-10-08T19:55:38.492062 #4] Rendering devise/mailer/confirmation_instructions.html.erb
[2019-10-08T19:55:38.496444 #4] FATAL -- :ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):

So you mailing template is trying to render, but throws an ActionView::Template::Error and actually tells you the problem:

Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true)

So you are using a link_to in your email, that one of course has to know the hostname, in order to create a full url. So you need to define that hostname somewhere.

For example you can set it in config/environments/production.rb by including

config.action_controller.default_url_options = {:host => "naijasinglesmeet.herokuapp.com"}

This is because your application does not know under which host/domain it is running, you have to tell it that.

A little tip, if you run into such problems, run heroku logs --tail, this will give you a continous logs as if you were using the development server.

Roland Studer
  • 4,315
  • 3
  • 27
  • 43