goauthentik / goauthentik/authentik

Authentik not honoring AUTHENTIK_POSTGRESQL__DEFAULT_SCHEMA

Open
#16,797 1 comment 0 reactions 0 assignees View on GitHub
bug status/reviewing
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 1h
Merged PRs (30d)
644

Description

**Describe the bug**
Following up from https://github.com/goauthentik/authentik/issues/12154 & https://github.com/goauthentik/authentik/pull/12949

Authentik does not respect using non-public schema. Schema migration appears to apply to one set via `AUTHENTIK_POSTGRESQL__DEFAULT_SCHEMA` env var, but looking into the database I see tables in the `public` schema as well.

**To Reproduce**
Deploying Authentik to a new Postgres cluster that uses a schema other than public. My example used `data` schema.

Setting was configured setting the `global.env` helm chart variable to `AUTHENTIK_POSTGRESQL__DEFAULT_SCHEMA` value to `data`.

Confirmed the postgres user has the `data` search_path.

See that there is a result for both
```sql
SELECT * FROM data.django_migrations
ORDER BY id ASC
```
and
```
SELECT * FROM public.django_migrations
ORDER BY id ASC
```

**Expected behavior**
`Public` schema to not be used.

**Screenshots**

**Logs**
crashloop logs from server
```sh
{"domain_url": null, "event": "releasing database lock", "level": "info", "logger": "lifecycle.migrate", "pid": 10, "schema_name": "data", "timestamp": "2025-09-16T05:18:32.358462"}
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/manage.py", line 52, in
execute_from_command_line(sys.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/ak-root/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
~~~~~~~~~~~~~~~^^
File "/ak-root/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
```

note that the worker eventaully does not crash loop

**Version and Deployment (please complete the following information):**

- authentik version: 2025.6.3
- Deployment: helm 2025.6.3

**Additional context**
Add any other context about the problem here.

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.