A user is experiencing an issue where Sidekiq logs show activation emails being sent to nil when users register on their Discourse installation. Despite successful email tests via discourse-doctor and a working admin account created via rake admin:create, registration emails fail to send, with to_address=>nil in the Jobs::CriticalUserEmail job. The user has followed the official installation guide, used a Mailgun SMTP setup, and rebuilt the app multiple times without success. The issue appears to be related to Redis or Sidekiq, as the Sidekiq interface shows a heartbeat failure and no errors in the logs. The user has shared detailed steps and screenshots, seeking help to diagnose the problem. LSudo, simon, LSudo, simon, LSudo, simon, LSudo, simon, LSudo, simon, LSudo, simon, LSudo
I can probably find it, but do you know what the name of the Sidekiq job was that triggered the email?
If you are not able to access the site because you aren’t receiving the activation email, you can create an admin user and password with rake admin:create. Full instructions are here: Create an admin account from the console. That should allow you to login to the site.
It sounds like you’ll still need to sort out what’s going on with email delivery though.
Sorry for the delayed response. The job that triggered it was: Jobs::CriticalUserEmail
So I followed the guide exactly. When it came to registering the admin account, it did not send an email, and Jobs::CriticalUserEmail contained {“type”=>“signup”, “user_id”=>1, “email_token”=>“REDACTED”, “to_address”=>nil, “current_site_id”=>“default”}.
I did force the admin account just so I could see what issues there were. The result is the following:
Doctor works and email is received
Digest test works and email is received both HTML version and Plain
Any registration no email is sent, and the log for emails in the admin section do not even show a message that an email was sent.
Whenever a user tries to register it’s the same result:
Jobs::CriticalUserEmail contained {“type”=>“signup”, “user_id”=>2, “email_token”=>“REDACTED”, “to_address”=>nil, “current_site_id”=>“default”}.
The tail of /var/discourse/shared/standalone/log/rails/production.log shows (with redactions):
Processing by UsersController#check_username as JSON
Parameters: {"username"=>"bobo", "email"=>"REDACTED"}
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 636)
Started GET "/session/csrf" for REDACTEDPUBLICIP at 2024-09-26 08:13:03 +0000
Processing by SessionController#csrf as JSON
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 270)
Started POST "/u" for REDACTEDPUBLICIP at 2024-09-26 08:13:03 +0000
Processing by UsersController#create as */*
Parameters: {"name"=>"JJ", "email"=>"REDACTED", "password"=>"[FILTERED]", "username"=>"bobo", "password_confirmation"=>"[FILTERED]", "challenge"=>"REDACTED", "timezone"=>"Europe/London"}
Completed 200 OK in 335ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 23323)
Started POST "/login" for REDACTEDPUBLICIP at 2024-09-26 08:13:04 +0000
Processing by StaticController#enter as HTML
Parameters: {"username"=>"bobo", "password"=>"[FILTERED]", "redirect"=>"/u/account-created"}
Redirected to https://REDACTEDDOMAIN/u/account-created
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 507)
Started GET "/u/account-created" for REDACTEDPUBLICIP at 2024-09-26 08:13:04 +0000
Processing by UsersController#account_created as HTML
Rendered layout layouts/application.html.erb (Duration: 14.0ms | Allocations: 4624)
Completed 200 OK in 21ms (Views: 15.1ms | ActiveRecord: 0.0ms | Allocations: 6821)
Started GET "/sidekiq/queues/critical" for REDACTEDPUBLICIP at 2024-09-26 08:13:15 +0000
In the log there, it does show accurate email for the registartaion parameters, but sideqik still reports “to_address”=>nil
Are there any errors on your site’s Error Logs page? That page is at /logs. You can get there from the admin sidebar by clicking the Security / Error Logs entry.
I can give you the exact process I used. Perhaps something in the process I am doing is wrong. I’m willing to totally accept I’m making a mistake somewhere!
Have domain. It is discourse.domain.dev (domain obviously redacted)
Have an email account setup. I have a mailgun account, so I set up a brand new user for SMTP. The email is discourse@discourse.domain.dev
Have server. It’s the latest Ubuntu (Jammy Jellyfish)
apt install docker.io - None
Git was already installed
user was root
cloned using git clone https://github.com/discourse/discourse_docker.git /var/discourse