Skip to content

"Never call result.get() within a task!" when creating a blueprint-instance inside a blueprint #13965

Closed as not planned
@ImmanuelVonNeumann

Description

@ImmanuelVonNeumann

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

  1. 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
  1. Modify helm values:
blueprints:
    configMaps:
      - blueprint
      - blueprint-instance
  1. Apply helm values
  2. In authentik apply the blueprint under "Customization > Blueprints > Blueprint Instance"
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus/staleThis issue has not been updated recently

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions