: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(temporalio): treat gRPC Unauthenticated as non-retryable (#63981)
Tom Owers8153a49d9590
diff --git a/posthog/temporal/data_imports/sources/temporalio/source.py b/posthog/temporal/data_imports/sources/temporalio/source.pyindex 1c1e1036016a..7b8209687549 100644--- a/posthog/temporal/data_imports/sources/temporalio/source.py+++ b/posthog/temporal/data_imports/sources/temporalio/source.py@@ -46,6 +46,10 @@ class TemporalIOSource(ResumableSource[TemporalIOSourceConfig, TemporalIOResumeC# come straight from the source config, so this is a malformed-credential problem — retrying# can never recover."CertificateParseError": "PostHog could not parse the TLS certificate or key configured for this source. Check that the client certificate, client private key, and server client root CA are valid PEM and were pasted in full, including the BEGIN and END lines.",+ # tonic surfaces a gRPC UNAUTHENTICATED status when the server requires API key (JWT/Bearer)+ # authentication, which this source does not provide — it authenticates with mTLS client+ # certificates. This is a credential/host configuration problem, so retrying can never recover.+ "code: Unauthenticated": "Temporal rejected the connection because it requires API key (JWT) authentication, which this source does not provide. This usually means the configured host points at a Temporal Cloud API endpoint that uses API key authentication rather than your namespace's mTLS gRPC endpoint (typically <namespace>.<account>.tmprl.cloud:7233). Update the source's host to the namespace's gRPC endpoint that accepts client-certificate (mTLS) authentication.",}def get_schemas(diff --git a/posthog/temporal/data_imports/sources/temporalio/test_temporalio.py b/posthog/temporal/data_imports/sources/temporalio/test_temporalio.pyindex fdceba97e70b..aefeef4df6b9 100644--- a/posthog/temporal/data_imports/sources/temporalio/test_temporalio.py+++ b/posthog/temporal/data_imports/sources/temporalio/test_temporalio.py@@ -61,6 +61,19 @@ class TestTemporalIONonRetryableErrors:f"Expected '{error_message}' to match a non-retryable pattern")+ @pytest.mark.parametrize(+ "error_message",+ [+ 'RuntimeError: Failed client connect: `get_system_info` call error after connection: Status { code: Unauthenticated, message: "Jwt is missing", metadata: MetadataMap { headers: {"www-authenticate": "Bearer realm=\\"https://us-east4.gcp.api.temporal.io/temporal.api.workflowservice.v1.WorkflowService/GetSystemInfo\\"", "content-type": "application/grpc", "server": "temporal"} }, source: None }',+ ],+ )+ def test_authentication_failures_are_non_retryable(self, error_message):+ non_retryable_errors = self.source.get_non_retryable_errors()++ assert any(pattern in error_message for pattern in non_retryable_errors), (+ f"Expected '{error_message}' to match a non-retryable pattern"+ )+@pytest.mark.parametrize("error_message",[