: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 (#63700)
Tom Owersb1041a93cea9
diff --git a/posthog/temporal/data_imports/sources/reddit_ads/source.py b/posthog/temporal/data_imports/sources/reddit_ads/source.pyindex f97e52f275a6..9ac026adb978 100644--- a/posthog/temporal/data_imports/sources/reddit_ads/source.py+++ b/posthog/temporal/data_imports/sources/reddit_ads/source.py@@ -41,7 +41,7 @@ class RedditAdsSource(ResumableSource[RedditAdsSourceConfig, RedditAdsResumeConf# 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,+ "403 Client Error": "PostHog is not authorized to access this Reddit Ads account. Please make sure the connected Reddit account has access to the ad account, then reconnect.","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 733fe514d908..2cbfacfda700 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,7 +114,8 @@ 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",+ # A 403 is a permission/auth failure (access revoked) and must not be retried.+ "403 Client Error: Forbidden for url: https://ads-api.reddit.com/api/v3/ad_accounts/09663b71-f301-484f-9b15-8d0e6fe69124/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",],