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(bigquery): Retry on 500 on get service account (#93959)

Tomás Farías Santana0a071f36fe04
diff --git a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
index bf08cbdaae47..9aaad1fd713c 100644
--- a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
+++ b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
@@ -467,6 +467,7 @@ def _make_requests_session() -> "requests.Session":
async def get_service_account_description(
service_account_email: str,
+ max_attempts: int = 5,
) -> str:
"""Return the service account's description.
@@ -475,8 +476,12 @@ async def get_service_account_description(
our_credentials = get_our_google_cloud_credentials()
client = iam_admin_v1.IAMAsyncClient(credentials=our_credentials)
+ retryable_get_service_account = make_retryable_with_exponential_backoff(
+ client.get_service_account, retryable_exceptions=(InternalServerError,), max_attempts=max_attempts
+ )
+
try:
- sa = await client.get_service_account(
+ sa = await retryable_get_service_account(
request=iam_admin_v1.GetServiceAccountRequest(name=f"projects/-/serviceAccounts/{service_account_email}")
)
except PermissionDenied: