From d9a835f525ffb3976eabc99dd3210a3804b59744 Mon Sep 17 00:00:00 2001 From: Zach Aysan Date: Tue, 6 Feb 2024 11:01:39 -0500 Subject: [PATCH] fix: Avoid errors when missing subscription information cache id (#3380) --- api/organisations/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/organisations/models.py b/api/organisations/models.py index 510a49ca320e..14aee0c60ccc 100644 --- a/api/organisations/models.py +++ b/api/organisations/models.py @@ -267,6 +267,11 @@ def save_as_free_subscription(self): if not getattr(self.organisation, "subscription_information_cache", None): return + # There is a weird bug where the cache is present, but the id is unset. + # See here for more: https://flagsmith.sentry.io/issues/4945988284/ + if not self.organisation.subscription_information_cache.id: + return + self.organisation.subscription_information_cache.delete() def prepare_for_cancel(