# Sidekiq shows activation emails being sent to email address nil

**URL:** https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140
**Category:** Self-hosting
**Tags:** email
**Created:** [September 25, 2024, 10:34pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140 "2024-09-25T22:34:17Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 25, 2024, 10:34pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/1 "2024-09-25T22:34:17Z")

</div>

Hey awesome folks,

Got a fun one for you. Here’s what happened:

1. Installed discourse using [discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md#6-install-discourse)
2. Tested email with doctor, works and emails recieved.
3. attempted to activate admin account and sideqik reveals this (with token redacted):  
{“type”=\>“signup”, “user\_id”=\>1, “email\_token”=\>“REDACTED”, “to\_address”=\>nil, “current\_site\_id”=\>“default”}

Not sure why nil is a thing for to\_address.

Any tips, advice, or suggestions would be most welcome!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 25, 2024, 11:26pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/2 "2024-09-25T23:26:58Z")

</div>

I can probably find it, but do you know what the name of the Sidekiq job was that triggered the email?

> [@LSudo](#):
>
> Any tips, advice, or suggestions would be most welcome!

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](https://meta.discourse.org/t/create-an-admin-account-from-the-console/17274). 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.

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 26, 2024, 8:34am UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/3 "2024-09-26T08:34:10Z")

</div>

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):

```plaintext
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

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 26, 2024, 7:27pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/4 "2024-09-26T19:27:47Z")

</div>

> [@LSudo](#):
>
> 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”}.

> [@LSudo](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 26, 2024, 7:41pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/5 "2024-09-26T19:41:11Z")

</div>

Oh interesting. I get this:

 ![This image displays a computer screen with a terminal window open, showing a directory listing and a message log with error messages. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/c/2/2/c22843c64c66c313c667b576ae7de5bf9a55711a.png)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 26, 2024, 7:56pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/6 "2024-09-26T19:56:26Z")

</div>

Are you able to access the Sidekiq web interface at `/sidekiq` ? If so, are there any errors being reported on that page?

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 26, 2024, 8:26pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/7 "2024-09-26T20:26:10Z")

</div>

I am, but what I get is this:

 ![A screenshot of a desktop computer interface with a dark theme, showing a dashboard with a calendar, history, and alarms. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/7/4/a/74a04e70dc55886684300981e74069f828988758.png)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 26, 2024, 8:28pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/8 "2024-09-26T20:28:01Z")

</div>

Try clicking on the “Enqueued” tab. It’s a link.

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 26, 2024, 8:38pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/9 "2024-09-26T20:38:43Z")

</div>

I get this:

 ![The image shows a table with rows and columns, containing text. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/6/d/96d4d71c2357108d9a81808a8f33c70e72e50cdb.png)

Which is where I discovered the address\_to=nil thing.

 !["The image displays a table with current job openings, listing various positions with descriptions and 'show more' buttons." (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/0/8/908c44be7950e27983ee865bf5474da17bb5f6af.png)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 26, 2024, 9:23pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/10 "2024-09-26T21:23:42Z")

</div>

There’s something wrong with Redis and/or Sidekiq. There are a few other members of this forum who might have ideas about how to debug the issue.

I’d be tempted to ssh into the server and run:

```plaintext
cd /var/discourse
./launcher rebuild app

```

It couldn’t hurt at this point.

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 26, 2024, 9:31pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/11 "2024-09-26T21:31:45Z")

</div>

Yeah, I’ve done that several times, hence my coming in to ask.

I’ve done a rebuild. I’ve even done a completely new install too.

Seems to happen every single install. No matter what. And I’m just lost now.

And I am incredibly grateful for what you have tried to help me with.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 27, 2024, 5:33pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/12 "2024-09-27T17:33:53Z")

</div>

> [@LSudo](#):
>
> I’ve done a rebuild. I’ve even done a completely new install too.
> 
> Seems to happen every single install.

That’s surprising. Make sure you are following all of the steps that are outlined here: . [discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md).

Also, make sure the server you are installing Discourse on meets the requirements that are outlined here: [discourse/docs/INSTALL.md at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/docs/INSTALL.md).

It would be great to sort out what’s going wrong.

---

<div class="post-metadata">

### Author: ![LSudo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lsudo/32/451845_2.png) [@LSudo](https://meta.discourse.org/u/LSudo)
#### Post date: [September 27, 2024, 9:21pm UTC](https://meta.discourse.org/t/sidekiq-shows-activation-emails-being-sent-to-email-address-nil/328140/13 "2024-09-27T21:21:54Z")

</div>

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!

1. Have domain. It is discourse.domain.dev (domain obviously redacted)
2. 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
3. Have server. It’s the latest Ubuntu (Jammy Jellyfish)
4. `apt install docker.io` - None
5. Git was already installed
6. user was root
7. cloned using `git clone https://github.com/discourse/discourse_docker.git /var/discourse`
8. navigated to cd /var/discourse
9. chmod 700 containers
10. still root user
11. ran ./discourse-setup
12. Filled in info as requested: discourse.domain.dev
13. Discourse Admin Email: my@personal.email
14. SMTP: [smtp.eu.mailgun.org](http://smtp.eu.mailgun.org)
15. SMTP PORT: 587
16. username: noreply@discourse.domain.dev
17. userpass: REDACTED
18. notification email: noreply@discourse.domain.dev
19. Lets encrypt email: my@personal.email
20. Maxmind ID: Put it in
21. Max Mind License: Put it in
22. Verified the input data for the setup.
23. Pressed Enter.
24. Waited.
25. Waited some more
26. Made a cuppa
27. Last line of the bootstrap process:  
`+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=8 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_FORCE_HTTPS=true -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=discourse.domain.dev -e DISCOURSE_DEVELOPER_EMAILS=my@personal.email -e DISCOURSE_SMTP_ADDRESS=smtp.eu.mailgun.org -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=noreply@discourse.domain.dev -e DISCOURSE_SMTP_PASSWORD=b7fc73b0905b5ffb5f70300f1f796000-1b5736a5-0a60075a -e DISCOURSE_SMTP_DOMAIN=discourse.example.com -e DISCOURSE_NOTIFICATION_EMAIL=noreply@discourse.domain.dev -e LETSENCRYPT_ACCOUNT_EMAIL=my@personal.email -e DISCOURSE_MAXMIND_ACCOUNT_ID=REDACTED -e DISCOURSE_MAXMIND_LICENSE_KEY=REDACTED -h devsite -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address REDACTGED local_discourse/app /sbin/boot REDACTEDLONGSTRING`
28. Ran `./discourse-doctor`. It failed because it could not connect to redis.
29. Ran `./laucher rebuild app` and changed nothing in the config
30. It built. All ok. The only difference was the last redacted long string.
31. Ran `./discourse-doctor`. I recieved the test email from it.
32. The site was up so went to create user account for the admin.
33. Clicked Register
34. It said that it was sending a notification email.
35. None recieved.
36. Checked through `./discourse-docter` and saw this:  
`Discourse version at discourse.domain.dev: NOT FOUND Discourse version at localhost: NOT FOUND`
37. Ran `./launcher enter app`
38. Ran `rake admin:create`
39. Put email: my@personal.email
40. Reset Password as user already exists
41. Told “Your account now has Admin priviledges!”
42. Logged in to site at the domain
43. Go to discourse.domain.dev/logs - see "Sidekiq heartbeat test failed, restarting`
44. Go to discourse.domain.dev/sidekiq: See:  
 ![This image is a digital screenshot of a user interface with a black background and a menu of options. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/8/2/a/82a7df9fb6a99b072e66c0b0845fb5c3f9e7851d.png)
45. Go to view Enqueued  
 ![The image shows a screenshot of a webpage displaying a table with data on queues. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/7/8/7/7872aab66b911c37e54b5a4b70615ee16774918b.png)
46. Click on “critical” and expand content and see “to\_address”=\>nil again.  
 ![The image displays a list of current job openings in Africa, organized into rows and columns. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/7/7/5/7758f7408e3cee7ab84483f09c1132f7fcfad8f3.png)

Stop, and reach out.

This is a complete redo on a new machine today. These are the EXACT same steps I used before. Please, if I messed up, let me know! 🙏

* * *

**System Setup:**

- CPU: 4 Cores
- RAM: 16 GB
- OS: Ubuntu LTS 64bit 24.04
- Storage: NVMe 500G
- Postgres Version: 13.16-1
- Redis: 7.0.7
- Ruby: 3.3.4
