goauthentik / goauthentik/authentik

test_email should give better error messages

Open
#24,289 2 comments 0 reactions 1 assignee Claimed by @rissson View on GitHub
enhancement enhancement/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 2h
Merged PRs (30d)
659

Description

### Is your feature request related to a problem?

I had a problem with email delivery and using `ak test_email` gave me the following error:
```
Traceback (most recent call last):
File "/nix/store/nxgss4v26wrp2bysqvd032y8anb0imdx-authentik-manage/bin/.manage.py-wrapped", line 35, in
execute_from_command_line(sys.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
~~~~~~~~~~~~~~~^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/django/core/management/base.py", line 420, in run_from_argv
self.execute(*args, **cmd_options)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/django/core/management/base.py", line 464, in execute
output = self.handle(*args, **options)
File "/nix/store/vdj8f8a3v5bws1hh13dwjlzfb9hc1amq-authentik-static-workdir-deps/authentik/tenants/management/__init__.py", line 38, in handle
self.handle_per_tenant(*args, **options)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/django/core/management/base.py", line 111, in wrapper
res = handle_func(*args, **kwargs)
File "/nix/store/vdj8f8a3v5bws1hh13dwjlzfb9hc1amq-authentik-static-workdir-deps/authentik/stages/email/management/commands/test_email.py", line 41, in handle_per_tenant
send_mail.send(message.__dict__, stage.pk).get_result(block=True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/dramatiq/message.py", line 167, in get_result
return backend.get_result(self, block=block, timeout=timeout)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/p91km4ph8j9chck6ry02ylazdglqbjm1-authentik-env/lib/python3.14/site-packages/dramatiq/results/backend.py", line 104, in get_result
raise ResultTimeout(message)
dramatiq.results.errors.ResultTimeout: [info about the test-email]
```

Seeing the "timeout", I tried debugging my network first, but it turned out to be a different error which only got logged on the worker

### Describe the solution you'd like

Ideally `test_email` would directly report the error that caused the failed delivery.

### Describe alternatives that you've considered

If the former is impossible/hard maybe either the command itself or the [documentation](https://docs.goauthentik.io/install-config/email/#test-email-delivery) (or both) could say where the relevant error can be found.

### Additional context

I am using the unsupported authentik-nix deploy method to deploy authentik as a NixOS service, but this should not affect this particular feature.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.