Skip to content

: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.

fix(shopify): treat 402 Payment Required as non-retryable (#63964)

Tom Owers7028f42c1649
diff --git a/posthog/temporal/data_imports/sources/shopify/tests/test_access_token.py b/posthog/temporal/data_imports/sources/shopify/tests/test_access_token.py
index 5ab06d963647..493dca6d64cd 100644
--- a/posthog/temporal/data_imports/sources/shopify/tests/test_access_token.py
+++ b/posthog/temporal/data_imports/sources/shopify/tests/test_access_token.py
@@ -70,12 +70,27 @@ def test_graphql_access_denied_is_non_retryable(error_message):
)
+ "error_message",
+ [
+ "402 Client Error: Payment Required for url: https://my-store.myshopify.com/admin/api/2025-10/graphql.json",
+ "402 Client Error: Payment Required for url: https://another-store.myshopify.com/admin/api/2024-01/graphql.json",
+ ],
+)
+def test_payment_required_is_non_retryable(error_message):
+ patterns = ShopifySource().get_non_retryable_errors()
+ assert any(pattern in error_message for pattern in patterns), (
+ f"402 Payment Required error '{error_message}' should match a non-retryable pattern"
+ )
+
+
@pytest.mark.parametrize(
"error_message",
[
"Shopify: rate limit exceeded...",
"Shopify: internal error from request 503 Service Unavailable",
"Unexpected graphql response format in Shopify rows read. Keys: ['extensions']",
+ "429 Client Error: Too Many Requests for url: https://my-store.myshopify.com/admin/api/2025-10/graphql.json",
],
)
def test_transient_graphql_errors_stay_retryable(error_message):