From 77822d51ee886bd8783901908dfef3a79bd8c192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Obermu=CC=88ller?= Date: Wed, 27 Sep 2023 13:50:48 +0200 Subject: [PATCH] fix feature flag handling for endpoints without auth --- posthog/hogql_queries/legacy_compatibility/feature_flag.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/posthog/hogql_queries/legacy_compatibility/feature_flag.py b/posthog/hogql_queries/legacy_compatibility/feature_flag.py index f773dec5f3407..2f77ba9e7942b 100644 --- a/posthog/hogql_queries/legacy_compatibility/feature_flag.py +++ b/posthog/hogql_queries/legacy_compatibility/feature_flag.py @@ -10,6 +10,9 @@ def hogql_insights_enabled(user: User) -> bool: # on PostHog Cloud, use the feature flag if is_cloud(): + if not hasattr(user, "distinct_id"): # exclude api endpoints that don't have auth from the flag + return False + return posthoganalytics.feature_enabled( "hogql-insights", user.distinct_id,