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(new_relic): stop retrying NerdGraph access-denied errors (#118346)

Tom Owers6f6313725376
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/source.py
index 1ab234d1ba52..f21c76739364 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/source.py
@@ -246,6 +246,9 @@ If your account is hosted in New Relic's EU data center, select the EU region.
"401 Client Error: Unauthorized for url: https://api.eu.newrelic.com": invalid_key,
"403 Client Error: Forbidden for url: https://api.newrelic.com": missing_permissions,
"403 Client Error: Forbidden for url: https://api.eu.newrelic.com": missing_permissions,
+ # NerdGraph reports an authorization failure inside its `errors` array on an HTTP 200
+ # rather than a 401/403, so it never matches the status-based keys above.
+ "New Relic GraphQL error: Access denied": missing_permissions,
}
def get_schemas(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic_source.py
index 4d04de82f8b3..2ad7352fe955 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic_source.py
@@ -20,6 +20,7 @@ class TestNewRelicSource:
("eu_unauthorized", "401 Client Error: Unauthorized for url: https://api.eu.newrelic.com/graphql"),
("us_forbidden", "403 Client Error: Forbidden for url: https://api.newrelic.com/graphql"),
("eu_forbidden", "403 Client Error: Forbidden for url: https://api.eu.newrelic.com/graphql"),
+ ("graphql_access_denied", "New Relic GraphQL error: Access denied."),
]
)
def test_non_retryable_errors_match_auth_failures(self, _name, observed_error):