: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(vercel): treat billing_charges 404 as non-retryable (#72705)
Tom Owersbcfb79e07dc5
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/source.pyindex f7f4eaea01e3..f7958221ca9d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/source.py@@ -96,6 +96,12 @@ To sync resources owned by a team, also enter the team's ID (found under **Team# stable status text and base host, not the per-request path/query."401 Client Error: Unauthorized for url: https://api.vercel.com": "Your Vercel access token is invalid or has been revoked. Create a new token in your Vercel account settings, then reconnect.","403 Client Error: Forbidden for url: https://api.vercel.com": "Your Vercel access token is not authorized for this resource. Check the token's scope (and team access), then reconnect.",+ # Vercel's FOCUS billing endpoint 404s when the configured team can't be resolved for+ # this token (wrong/missing Team ID, or the token's user no longer belongs to that+ # team) rather than the 403 it returns for a role that lacks billing access. Retrying+ # never resolves a bad team reference, so stop the sync. Match the stable path, not the+ # query string (it carries the per-request date window and team id).+ "404 Client Error: Not Found for url: https://api.vercel.com/v1/billing/charges": "Vercel couldn't find billing data for the configured team. Check that the Team ID is correct and that your access token's user still belongs to that team, then reconnect.",}def get_schemas(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/tests/test_vercel_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/tests/test_vercel_source.pyindex 9a1f65fd76d8..20126891a86d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/tests/test_vercel_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/tests/test_vercel_source.py@@ -102,6 +102,10 @@ class TestVercelSource:[("unauthorized", "401 Client Error: Unauthorized for url: https://api.vercel.com/v6/deployments?limit=100"),("forbidden", "403 Client Error: Forbidden for url: https://api.vercel.com/v9/projects?limit=100"),+ (+ "billing_charges_team_not_found",+ "404 Client Error: Not Found for url: https://api.vercel.com/v1/billing/charges?from=2026-01-01T00%3A00%3A00.000Z&to=2026-02-01T00%3A00%3A00.000Z&teamId=team_abc",+ ),])def test_credential_errors_are_non_retryable(self, _name: str, observed_error: str) -> None:@@ -113,6 +117,9 @@ class TestVercelSource:("rate_limit", "429 Client Error: Too Many Requests for url: https://api.vercel.com/v6/deployments"),("server_error", "500 Server Error: Internal Server Error for url: https://api.vercel.com/v6/deployments"),("read_timeout", "HTTPSConnectionPool(host='api.vercel.com', port=443): Read timed out."),+ # Not-found on a non-billing endpoint is unrelated to the billing_charges team-lookup+ # failure, so the match must stay scoped to that path rather than any 404 on the host.+ ("not_found_other_endpoint", "404 Client Error: Not Found for url: https://api.vercel.com/v6/deployments"),])def test_transient_errors_remain_retryable(self, _name: str, other_error: str) -> None: