: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): give an actionable message when the access token is rejected (#80070)
Tom Owers1ea5f3e75140
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 6718797cefef..5d83084dede4 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@@ -108,7 +108,16 @@ class TestVercelSource:assert [s.name for s in schemas] == ["deployments"]@parameterized.expand(- [("valid", (True, None)), ("invalid", (False, "Invalid or unauthorized Vercel access token"))]+ [+ ("valid", (True, None)),+ (+ "invalid",+ (+ False,+ "Your Vercel access token is invalid or has been revoked. Create a new token in your Vercel account settings, then reconnect.",+ ),+ ),+ ])def test_validate_credentials_delegates(self, _name: str, result: tuple) -> None:with mock.patch.object(vercel_source_module, "validate_vercel_credentials", lambda token: result):diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/vercel.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/vercel.pyindex 6ae1c2c697ec..aa6324a834fa 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/vercel.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vercel/vercel.py@@ -161,8 +161,16 @@ def validate_credentials(access_token: str) -> tuple[bool, str | None]:if response.status_code == 200:return True, None- if response.status_code in (401, 403):- return False, "Invalid or unauthorized Vercel access token"+ if response.status_code == 401:+ return (+ False,+ "Your Vercel access token is invalid or has been revoked. Create a new token in your Vercel account settings, then reconnect.",+ )+ if response.status_code == 403:+ return (+ False,+ "Your Vercel access token is not authorized for this resource. Check the token's scope (and team access), then reconnect.",+ )# 429 (rate limit) and 5xx are transient Vercel-side problems, not a bad token, so surface a# retry hint rather than telling the user to fix credentials they can't fix.if response.status_code == 429 or response.status_code >= 500: