: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(snowflake): treat persistent HTTP 403 as non-retryable (#72165)
Tom Owers4ffcb47f5fbc
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.pyindex 8c6154cfb465..aad713c303d5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py@@ -290,6 +290,14 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig]):# matches the columns its query produces, so the view itself fails to compile. This is# a broken object on the source side that retrying can't repair."but view query produces": "A Snowflake view in your source is invalid — the columns it declares no longer match the columns its query returns. Please recreate the view in Snowflake so the two agree, then resync.",+ # Snowflake connector error 290403 (ER_HTTP_GENERAL_ERROR + 403): a request to Snowflake+ # returned HTTP 403 Forbidden and kept doing so through the connector's own retry budget.+ # The connector treats 403 as retryable and retries within the request timeout, so a+ # ForbiddenError reaching us means the 403 is persistent — an access-denied condition+ # (a network policy/firewall/proxy blocking PostHog, or the role's access to the data+ # being revoked), not a transient blip. Retrying the whole sync can't fix it. The errno+ # prefix and host are volatile, so we match the stable status text.+ "HTTP 403: Forbidden": "Snowflake refused the request with an HTTP 403 (forbidden). This usually means a network policy or firewall on your account is blocking PostHog's access, or your role's access to the data was revoked. Check your Snowflake network access rules and role grants, then resync.",}def reconcile_schema_metadata(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.pyindex c1c4d4bcca3d..1f9b8ee73c1c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py@@ -772,6 +772,20 @@ class TestSnowflakeSourceNonRetryableErrors:is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())assert is_non_retryable, f"Network-policy block should be non-retryable: {error_msg}"+ @pytest.mark.parametrize(+ "error_msg",+ [+ "HTTP 403: Forbidden",+ # The real shape from production: the errno prefix and host vary, but the status+ # text is stable. Newlines are normalized to spaces upstream.+ "290403: 290403: HTTP 403: Forbidden",+ ],+ )+ def test_forbidden_403_is_non_retryable(self, source, error_msg):+ non_retryable = source.get_non_retryable_errors()+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())+ assert is_non_retryable, f"Persistent HTTP 403 should be non-retryable: {error_msg}"+@pytest.mark.parametrize("error_msg",[