fix(events): annotate ListEvents errors with status/request id/window#165
Open
arreyder wants to merge 2 commits into
Open
fix(events): annotate ListEvents errors with status/request id/window#165arreyder wants to merge 2 commits into
arreyder wants to merge 2 commits into
Conversation
…ndow The vendored okta-sdk-golang *okta.Error formatter returns the literal string "the API returned an unknown error" when neither ErrorDescription nor ErrorSummary is populated (HTML 5xx pages, gateway timeouts, non-JSON bodies). It also drops HTTP status and X-Okta-Request-Id. Errors arriving in prod traces were undiagnosable. Wrap GetLogs errors with HTTP status, X-Okta-Request-Id, and the request's `since` / `after` query window. Uses %w so callers can still errors.Is / errors.As the inner *okta.Error. Adds event_log_test.go covering: - Full-context wrap (status + request_id + window) - Nil response (early network failure) - Missing optional fields elided cleanly Refs OPS-1539 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Connector PR Review: fix(events): annotate ListEvents errors with status/request id/windowBlocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. |
…bvars) CI lint (usestdlibvars) flagged the literal `502` and `500` HTTP status codes in the wrap-error test fixtures; replace with `http.StatusBadGateway` and `http.StatusInternalServerError`. Behavior unchanged. Refs OPS-1539 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes OPS-1539.
Summary
okta-sdk-golang*okta.Errorformatter returns the literal string"the API returned an unknown error"whenever neitherErrorDescriptionnorErrorSummaryis populated (HTML 5xx pages, gateway timeouts, non-JSON bodies). It also drops HTTP status andX-Okta-Request-Id. Errors reaching prod traces were undiagnosable.LogEvent.GetLogserrors with HTTP status,X-Okta-Request-Id, and the request'ssince/afterquery window. Uses%wso callers can stillerrors.Is/errors.Asagainst the inner*okta.Error.wrapListEventsErrorhelper so we have a single place to extend for additional Okta call sites later (the OPS-1539 ticket flags this as a follow-up across other*OktaSDK calls).Test plan
go test -count=1 -short ./pkg/connector/...passes locallyevent_log_test.gocovers:key=errors.Is(wrapped, inner)continues to hold"the API returned an unknown error"is now prefixed with usable contextFollow-ups (not in this PR)
*OktaSDK call sites for consistency once we have a second consumer ofwrapListEventsErrorto justify generalizing it.ConductorOne/okta-sdk-golangfork to include status + body by default — the "unknown error" sentinel is a known footgun.🤖 Generated with Claude Code