authentik
authentik copied to clipboard
"Never call result.get() within a task!" when creating a blueprint-instance inside a blueprint
Describe the bug When creating a blueprint instance from a blueprint the following error appears:
[...]
File "/authentik/blueprints/api.py", line 42, in validate_path files: list[dict] = blueprints_find_dict.delay().get()
[...]
builtins.RuntimeError: Never call result.get() within a task! See https://docs.celeryq.dev/en/latest/userguide/tasks.html#avoid-launching-synchronous-subtasks
To Reproduce Steps to reproduce the behavior (k8s with helm):
- Mount the following files as blueprints:
# configmap_name: blueprint
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
version: 1
metadata:
name: Blueprint
labels:
blueprints.goauthentik.io/description: |
Blueprint
blueprints.goauthentik.io/instantiate: "false"
entries: []
# configmap_name: blueprint-instance
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
version: 1
metadata:
name: Blueprint Instance
labels:
blueprints.goauthentik.io/description: |
Blueprint Instance
entries:
- attrs:
path: mounted/cm-blueprint/blueprint.yaml
identifiers:
name: Blueprint Instance
model: authentik_blueprints.blueprintinstance
state: present
- Modify helm values:
blueprints:
configMaps:
- blueprint
- blueprint-instance
- Apply helm values
- In authentik apply the blueprint under "Customization > Blueprints > Blueprint Instance"
- Observe error (details in Dashboards > System Tasks)
Screenshots
Logs
Full stack trace
Traceback (most recent call last): File "/ak-root/venv/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task R = retval = fun(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "/ak-root/venv/lib/python3.12/site-packages/celery/app/trace.py", line 736, in __protected_call__ return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/blueprints/v1/tasks.py", line 211, in apply_blueprint valid, logs = importer.validate() ^^^^^^^^^^^^^^^^^^^ File "/authentik/blueprints/v1/importer.py", line 456, in validate successful = self._apply_models(raise_errors=raise_validation_errors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/blueprints/v1/importer.py", line 397, in _apply_models serializer = self._validate_single(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/blueprints/v1/importer.py", line 351, in _validate_single serializer.is_valid(raise_exception=True) File "/ak-root/venv/lib/python3.12/site-packages/rest_framework/serializers.py", line 227, in is_valid self._validated_data = self.run_validation(self.initial_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ak-root/venv/lib/python3.12/site-packages/rest_framework/serializers.py", line 426, in run_validation value = self.to_internal_value(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ak-root/venv/lib/python3.12/site-packages/rest_framework/serializers.py", line 485, in to_internal_value validated_value = validate_method(validated_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/blueprints/api.py", line 42, in validate_path files: list[dict] = blueprints_find_dict.delay().get() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ak-root/venv/lib/python3.12/site-packages/celery/result.py", line 237, in get assert_will_not_block() File "/ak-root/venv/lib/python3.12/site-packages/celery/result.py", line 38, in assert_will_not_block raise RuntimeError(E_WOULDBLOCK) builtins.RuntimeError: Never call result.get() within a task! See https://docs.celeryq.dev/en/latest/userguide/tasks.html#avoid-launching-synchronous-subtasks
Version and Deployment (please complete the following information):
- authentik version: 2025.2.2, 2025.2.24
- Deployment: helm
Additional context Add any other context about the problem here.
We're reworking tasks in #13492, and this will go away with that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.