: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(warehouse-sources): retry railway's generic graphql error (#85074)
Tom Owers55877e59cae2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/railway.py b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/railway.pyindex dfbbd739a730..f6d728b1692d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/railway.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/railway.py@@ -55,6 +55,13 @@ def _raise_for_graphql_errors(payload: dict[str, Any]) -> None:# Stable prefix matched by `get_non_retryable_errors` — Railway returns auth failures# as HTTP 200 + a GraphQL error, so there is no 401 status to key off.raise Exception(f"Railway API error: Not Authorized. GraphQL errors: {messages}")+ if "Problem processing request" in messages:+ # Railway's generic internal-error message, also returned as HTTP 200 + a GraphQL error.+ # Their support forum confirms it's usually a transient backend hiccup, so retry it like+ # the 429/5xx statuses below rather than aborting the whole sync on the first occurrence.+ raise RailwayRetryableError(+ f"Railway API error (retryable): Problem processing request. GraphQL errors: {messages}"+ )raise Exception(f"Railway GraphQL error: {messages}")diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway.py b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway.pyindex 879d16ee05d1..6671fae8f6b4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway.py@@ -234,6 +234,13 @@ class TestRailway:non_retryable = RailwaySource().get_non_retryable_errors()assert any(key in str(exc_info.value) for key in non_retryable)+ def test_problem_processing_request_error_is_retryable(self):+ # Railway returns this generic message as HTTP 200 + a GraphQL error for what their own+ # support forum confirms is usually a transient backend hiccup — it must retry like the+ # 429/5xx statuses below, not abort the sync on the first occurrence.+ with pytest.raises(RailwayRetryableError):+ railway._raise_for_graphql_errors({"errors": [{"message": "Problem processing request"}]})+@parameterized.expand([(429,), (500,), (503,)])def test_retryable_status_codes(self, status_code):session = mock.MagicMock()diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.pyindex d05e1cb99d67..727f53054e49 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/railway/tests/test_railway_source.py@@ -84,6 +84,10 @@ class TestRailwaySource:[("rate_limit", "Railway API error (retryable): status=429, retry_after=60"),("server_error", "Railway API error (retryable): status=500, retry_after=None"),+ (+ "problem_processing_request",+ "Railway API error (retryable): Problem processing request. GraphQL errors: Problem processing request",+ ),("connection_error","HTTPSConnectionPool(host='backboard.railway.com', port=443): Max retries exceeded with url: "