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(google-play-console): stop retrying 404s for unknown app packages (#130820)

Tom Owers3575da85e9ab
diff --git a/products/warehouse_sources/sources/google_play_console/source.py b/products/warehouse_sources/sources/google_play_console/source.py
index d8b400152033..330266e0b729 100644
--- a/products/warehouse_sources/sources/google_play_console/source.py
+++ b/products/warehouse_sources/sources/google_play_console/source.py
@@ -88,6 +88,12 @@ class GooglePlayConsoleSource(ResumableSource[GooglePlayConsoleSourceConfig, Goo
"API in its Google Cloud project, and give the service account permission to view app quality "
"data in Play Console."
),
+ # Every per-app route answers 404 for a package Play doesn't know or the service account
+ # can't see, typically a mistyped or removed name in `app_package_names`.
+ "404 Client Error: Not Found for url: https://playdeveloperreporting.googleapis.com/": (
+ "Google Play couldn't find one of your apps, or the service account can't see it. "
+ "Check the app package names in your source settings, then re-enable the sync."
+ ),
"Google rejected the service account key": (
"Google rejected the service account key. Check that the key is still active and upload a current one."
),
diff --git a/products/warehouse_sources/sources/google_play_console/tests/test_google_play_console.py b/products/warehouse_sources/sources/google_play_console/tests/test_google_play_console.py
index 46344d1a5896..e64120dd5310 100644
--- a/products/warehouse_sources/sources/google_play_console/tests/test_google_play_console.py
+++ b/products/warehouse_sources/sources/google_play_console/tests/test_google_play_console.py
@@ -473,6 +473,26 @@ def test_metric_set_reraises_a_403_that_is_not_the_games_restriction() -> None:
assert isinstance(result.raised, requests.HTTPError)
[email protected]("schema_name", ["crash_rate", "error_issues"])
+def test_unknown_app_stops_the_sync_with_package_name_copy(schema_name: str) -> None:
+ result = _run(
+ schema_name,
+ [ScriptedResponse(status=404, body=b'{"error": {"code": 404, "status": "NOT_FOUND"}}')],
+ package_names="com.example.missing",
+ )
+
+ source = GooglePlayConsoleSource()
+ error = str(result.raised)
+ messages = [
+ message
+ for pattern, message in source.get_non_retryable_errors().items()
+ if message and error_message_matches(error, [pattern])
+ ]
+ assert messages and "package names" in messages[0]
+ assert "com.example.missing" not in messages[0]
+ assert not error_message_matches(error, source.get_retryable_errors())
+
+
@pytest.mark.parametrize("status", [500, 502, 503])
def test_metric_set_server_error_stays_retryable_with_vendor_outage_copy(status: int) -> None:
with mock.patch(f"{MODULE}._today", return_value=TODAY):