From de22a367b182fbe19b3b8c7321a8a37aca3e4b89 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Feb 2021 15:22:43 +0100 Subject: [PATCH] events: fix error when event can't be loaded into rule task --- authentik/events/tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentik/events/tasks.py b/authentik/events/tasks.py index 8f6309da7..aa9793bf5 100644 --- a/authentik/events/tasks.py +++ b/authentik/events/tasks.py @@ -30,7 +30,11 @@ def event_notification_handler(event_uuid: str): @CELERY_APP.task() def event_trigger_handler(event_uuid: str, trigger_name: str): """Check if policies attached to NotificationRule match event""" - event: Event = Event.objects.get(event_uuid=event_uuid) + events = Event.objects.filter(event_uuid=event_uuid) + if not events.exists(): + LOGGER.warning("event doesn't exist yet or anymore", event_uuid=event_uuid) + return + event: Event = events.first() trigger: NotificationRule = NotificationRule.objects.get(name=trigger_name) if "policy_uuid" in event.context: