: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(bigquery): treat missing GCP project as non-retryable (#69139)
Tom Owersd9dbd75546b1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.pyindex 2ed8c6b438de..0159c85bba6a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py@@ -176,6 +176,15 @@ class BigQuerySource(SQLSource[BigQuerySourceConfig]):# rename it back, or remove it from the sync. Matched on the stable "Not found: Table"# wording rather than the volatile table id."Not found: Table": "BigQuery couldn't find a table this source is syncing — it was deleted or renamed after the source was set up. Restore or rename the table in BigQuery, or remove it from this source's synced tables, then re-enable the source.",+ # Raised from `bq_client.get_table(...)` in `_build_source_response` (and other calls) when+ # the GCP project the source references no longer exists — it was deleted, or the Project ID+ # in the service account key file (or the configured dataset project) is wrong. The google+ # exception stringifies as "... Project <id> is not found. Make sure it references valid GCP+ # project that hasn't been deleted.", which the table/dataset "Not found" keys don't cover, so+ # it slips through and retries forever. Retrying can't conjure a missing project; the user+ # must fix the project reference. Matched on the stable guidance wording rather than the+ # volatile project id that appears earlier in the message.+ "Make sure it references valid GCP project": "BigQuery couldn't find the Google Cloud project this source references — it may have been deleted, or the Project ID in your service account key file (or the configured dataset project) may be incorrect. Verify the project exists in Google Cloud and correct the project details in your source configuration, then reconnect the source.",# Raised by google-cloud-bigquery's `TableReference.from_string` when a table id has# more than the three `project.dataset.table` components. This happens when the# Dataset ID field is set to `project.dataset` instead of just `dataset` — we thendiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.pyindex 4266191c0195..87ea1abd283d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py@@ -1392,6 +1392,27 @@ def test_bigquery_table_not_found_key_does_not_match_unrelated_errors(other_erroassert not any(key in other_error for key in non_retryable_errors)+def test_bigquery_project_not_found_during_sync_is_non_retryable():+ """A source referencing a deleted or mistyped GCP project surfaces from `get_table()` at sync time+ as a google NotFound whose str() is "... Project <id> is not found. Make sure it references valid+ GCP project that hasn't been deleted." — distinct from the table/dataset "Not found" wording. It+ must be recognised as non-retryable instead of retrying a project that can't reappear within the run."""+ error = NotFound(+ "GET https://bigquery.googleapis.com/bigquery/v2/projects/my-proj/datasets/my_dataset/"+ "tables/my_table?prettyPrint=false: Project my-proj is not found. Make sure it references "+ "valid GCP project that hasn't been deleted.; Project id: my-proj"+ )++ error_msg = str(error)+ non_retryable_errors = BigQuerySource().get_non_retryable_errors()+ matching = [key for key in non_retryable_errors if key in error_msg]++ assert matching, "a project-not-found 404 during sync should be recognised as non-retryable"+ assert all(non_retryable_errors[key] is not None for key in matching)+ assert "Not found: Table" not in error_msg+ assert "was not found in location" not in error_msg++def test_bigquery_storage_read_client_disables_grpc_message_size_limit():"""Regression: the Storage Read API streams Arrow ReadRowsResponse messages that canexceed gRPC's default 4 MiB client receive limit (wide rows / large string columns like