Home > Net >  How to solve the signup error in ruby on Rails after deploying to Heroku
How to solve the signup error in ruby on Rails after deploying to Heroku

Time:08-17

I am pretty new to Ruby on Rails and I'm currently building this application. However, I realized that after I deployed it to Heroku, I couldn't signup a new user. I made use of devise gem for the signup and sign-in as well as letter_opener gem.

When I tried signing up, it redirects me to the page attached here. I am also suspecting if it could be the devise gem that I installed because the whole problem starts as soon as I hit the sign-up button which is supposed to redirect me to a password confirm page.

Please, can anyone help with what exactly is going on?

Error image


2022-08-13T04:32:03.142879 00:00 app[web.1]: I, [2022-08-13T04:32:03.142765 #4]  INFO -- : [3ad2f557-6d51-4357-80f7-9a96c91fd22c]   Rendered vendor/bundle/ruby/3.1.0/gems/devise-4.8.1/app/views/devise/mailer/confirmation_instructions.html.erb (Duration: 6.5ms | Allocations: 440)
2022-08-13T04:32:03.320350 00:00 app[web.1]: I, [2022-08-13T04:32:03.320193 #4]  INFO -- : [3ad2f557-6d51-4357-80f7-9a96c91fd22c] Completed 500 Internal Server Error in 524ms (ActiveRecord: 5.8ms | Allocations: 5985)
2022-08-13T04:32:03.331589 00:00 app[web.1]: F, [2022-08-13T04:32:03.331463 #4] FATAL -- : [3ad2f557-6d51-4357-80f7-9a96c91fd22c]   
2022-08-13T04:32:03.331590 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c] ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
2022-08-13T04:32:03.331591 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c]     2: 
2022-08-13T04:32:03.331593 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c]     3: <p>You can confirm your account email through the link below:</p>
2022-08-13T04:32:03.331594 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c]     4: 
2022-08-13T04:32:03.331595 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c]     5: <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
2022-08-13T04:32:03.331595 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c]   
2022-08-13T04:32:03.331596 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c] actionpack (7.0.3.1) lib/action_dispatch/http/url.rb:64:in `full_url_for'
2022-08-13T04:32:03.331597 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c] actionpack (7.0.3.1) lib/action_dispatch/http/url.rb:54:in `url_for'
2022-08-13T04:32:03.331598 00:00 app[web.1]: [3ad2f557-6d51-4357-80f7-9a96c91fd22c] actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:334:in `block in <class:RouteSet>'

CodePudding user response:

Thank you very much to those that responded. I was able to fix the issue and the error was caused by the confirmable in the devise gem. I commented it out and included this line of code below in my production.rb file :

config.action_mailer.default_url_options = { :host => "yourhost" }

After that, my app was able to serve without issues when deployed to Heroku.

  • Related