From a8b77a4caaf52e1e0cc80c8eb32dc2cc340c481d Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Sat, 9 Nov 2024 10:50:15 +0200 Subject: [PATCH] fix(api): when assignees is not a dict --- keep/api/models/alert.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keep/api/models/alert.py b/keep/api/models/alert.py index 30d2d1c8f..01319ac44 100644 --- a/keep/api/models/alert.py +++ b/keep/api/models/alert.py @@ -287,7 +287,8 @@ def set_default_values(cls, values: Dict[str, Any]) -> Dict[str, Any]: values["lastReceived"] = lastReceived assignees = values.pop("assignees", None) - if assignees: + # In some cases (for example PagerDuty) the assignees is list of dicts and we don't handle it atm. + if assignees and isinstance(assignees, dict): dt = datetime.datetime.fromisoformat(lastReceived) dt.isoformat(timespec="milliseconds").replace("+00:00", "Z") assignee = assignees.get(lastReceived) or assignees.get(dt)