Repository navigation
Log requests the caller abandoned as 499, not server errors - #1778
Merged
Merged
Conversation
GET /embed returned 502 in 1.5ms and was reported as an error. The app's stream preview WebView aborts /embed whenever the preview closes (iOS loads a blank page to silence audio) or switches channel, and the Twitch/Kick lookup then fails at once on the canceled request context, so the handler answers 502. LoggingMiddleware, which fronts /embed, /metadata, /auth/ and the webhooks, now records a request whose context was canceled as 499 at info level, whatever the handler wrote. Webhook persistence failures keep their own error reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EzdqAWrbTMdtJutmK41coy
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.
Problem
Error group
CKKelvOqqIPn0QE:A 1.5ms 502 never reached Twitch or Kick. Since #1770, the app's stream preview WebView loads
/embeddirectly, and it aborts that request in two cases:StreamPreview.disposeloads a blank page on iOS to silence audiodidUpdateWidgetloads a new URLOnce the client has gone, the request context is canceled. The handler's
twitch...Userorkick...Getthen fails at once, and/embedanswers502 provider unavailable.LoggingMiddlewarelogs any status of 500 or above as an error.This is the same pattern #1751 fixed for callables, this time on the plain-HTTP routes.
Fix
LoggingMiddlewarefronts/embed,/embedRedirect,/metadata,/api/metadata,/auth/and the webhook prefixes. When a request's own context was canceled, it now records the request as 499 at info level, whatever the handler wrote. That one check covers every route.A server failure while the caller is still connected is still logged as an error (
TestLoggingMiddleware). Webhook persistence failures keep their own error reports, such askick webhook create message failed.Tests
TestEmbedAbortedByClientIsNotAnErrorsends a canceled request throughLoggingMiddlewareand the real/embedhandler, with a transport that behaves likehttp.Clienton a canceled context. Onmainit logsstatus=502at error level, matching production. Here it logs 499 at info level.go test -race ./internal/webhook ./internal/publichttp ./cmdpasses.Generated by Claude Code