:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-imports): treat Reddit Ads 403 Forbidden as non-retryable (#63963)
Tom Owerscb284a2ed290
diff --git a/posthog/temporal/data_imports/sources/reddit_ads/source.py b/posthog/temporal/data_imports/sources/reddit_ads/source.pyindex 841219a16824..f97e52f275a6 100644--- a/posthog/temporal/data_imports/sources/reddit_ads/source.py+++ b/posthog/temporal/data_imports/sources/reddit_ads/source.py@@ -38,6 +38,10 @@ class RedditAdsSource(ResumableSource[RedditAdsSourceConfig, RedditAdsResumeConfdef get_non_retryable_errors(self) -> dict[str, str | None]:return {"401 Client Error": None,+ # Reddit returns 403 when the connected account lacks permission to read the+ # configured ad account's reports (access revoked or insufficient scope). The+ # request can never succeed without the user reconnecting, so stop retrying.+ "403 Client Error": None,"404 Client Error": None,# Raised by OAuthMixin.get_oauth_integration when the connected Reddit Ads# account has been deleted or disconnected. The integration row is gone, sodiff --git a/posthog/temporal/data_imports/sources/reddit_ads/tests/test_reddit_source.py b/posthog/temporal/data_imports/sources/reddit_ads/tests/test_reddit_source.pyindex 17bd2015efd8..733fe514d908 100644--- a/posthog/temporal/data_imports/sources/reddit_ads/tests/test_reddit_source.py+++ b/posthog/temporal/data_imports/sources/reddit_ads/tests/test_reddit_source.py@@ -114,6 +114,7 @@ class TestRedditAdsSource:"observed_error",["401 Client Error: Unauthorized for url: https://ads-api.reddit.com/api/v3/ad_accounts/789/campaigns",+ "403 Client Error: Forbidden for url: https://ads-api.reddit.com/api/v3/ad_accounts/789/reports?page.size=100","404 Client Error: Not Found for url: https://ads-api.reddit.com/api/v3/ad_accounts/789/campaigns","ValueError: Integration not found: 154683",],