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(doit): stop retrying a DoIt key rejected for missing expiration (#105319)

Daniel RC5c825eec70a7
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py
index 437e4876f2e1..067f1ca0ffe8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py
@@ -62,6 +62,7 @@ class DoItSource(SimpleSource[DoItSourceConfig]):
def get_non_retryable_errors(self) -> dict[str, str | None]:
report_gone = "The DoIt report no longer exists. It may have been deleted or renamed in DoIt. Reconnect the source or select a different report."
+ bad_key = "Your DoIt API key is invalid or has been revoked. Please create a new key and reconnect."
return {
# Still reachable: rows persisted without a report id fall back to the name lookup.
"Report no longer exists": report_gone,
@@ -69,7 +70,10 @@ class DoItSource(SimpleSource[DoItSourceConfig]):
"Request to get report failed with status: 404": report_gone,
# DoIt's own rejection text for a bad key, stable across both the list and get-report
# endpoints since they share the same bearer token check.
- "invalid or revoked access key": "Your DoIt API key is invalid or has been revoked. Please create a new key and reconnect.",
+ "invalid or revoked access key": bad_key,
+ # DoIt answers 403 with this text for a key it no longer accepts. Only a new key fixes it,
+ # so a retry cannot succeed.
+ "invalid token: missing expiration": bad_key,
}
def source_for_pipeline(self, config: DoItSourceConfig, inputs: SourceInputs) -> SourceResponse:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py
index 61ee98716901..46325494c217 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py
@@ -27,6 +27,7 @@ class TestDoItSource:
"Report no longer exists",
"Request to get report failed with status: 404",
"invalid or revoked access key",
+ "invalid token: missing expiration",
],
)
def test_non_retryable_errors_includes_pattern(self, pattern):
@@ -34,10 +35,11 @@ class TestDoItSource:
assert pattern in errors
- def test_non_retryable_errors_tells_the_customer_to_reconnect_on_a_bad_key(self):
+ @pytest.mark.parametrize("pattern", ["invalid or revoked access key", "invalid token: missing expiration"])
+ def test_non_retryable_errors_tells_the_customer_to_reconnect_on_a_bad_key(self, pattern: str):
errors = self.source.get_non_retryable_errors()
- assert "reconnect" in (errors["invalid or revoked access key"] or "")
+ assert "reconnect" in (errors[pattern] or "")
def test_get_schemas_stamps_the_report_id_so_renames_stay_resolvable(self):
with patch(