<#1235 fix: raise InitializationError when auth-co...
# flyte-github
a
#1235 fix: raise InitializationError when auth-config endpoint returns HTML Pull request opened by EngHabu Problem Sentry: FLYTE-SDK-5N (count 3, recurring on the latest SDK 2.5.1) The first call the SDK makes against a configured endpoint is the unauthenticated
AuthMetadataService
config fetch (
get_public_client_config
/
get_o_auth2_metadata
). When that endpoint returns an HTML body instead of protobuf — typically a misconfigured endpoint (a web console / login URL rather than the API endpoint), or a proxy/ingress that doesn't forward gRPC/Connect traffic — connectrpc raises:
Copy code
ConnectError(UNKNOWN, "invalid content-type: 'text/html'; expecting 'application/proto'")
This propagated up through
RemoteClientConfigStore.get_client_config
and leaked into Sentry wrapped as
RuntimeSystemError("Upload failed for .../spec.pb")
, masking a clear user misconfiguration as an SDK/system bug. Fix
RemoteClientConfigStore.get_client_config
now catches the content-type
ConnectError
and re-raises it as
InitializationError("InvalidEndpoint", "user", ...)
with an actionable message pointing the user at their endpoint configuration.
InitializationError
is in the
_is_user_error
allowlist, so the wrapped cause chain is filtered from Sentry. Other
ConnectError
codes (e.g.
UNAVAILABLE
) still propagate unchanged. Note:
Code.UNKNOWN
is intentionally not added to the global
_USER_ACTIONABLE_CONNECT_CODES
filter set — UNKNOWN is too broad and can indicate real bugs; the fix is scoped to the content-type signal at the config-fetch site. Tests •
TestGetClientConfigHtmlResponse
— HTML content-type → `InitializationError("InvalidEndpoint")`; other ConnectError codes propagate. •
test_capture_exception_skips_wrapped_invalid_endpoint_error
— the full
RuntimeSystemError → InitializationError
chain is filtered from Sentry.
make fmt
clean; full
test_sentry.py
+
test_connectrpc_error_handling.py
pass (44). fixes FLYTE-SDK-5N flyteorg/flyte-sdk