[superlog] Skip ERROR logging for client-disconnect AbortErrors in RPC interceptor#478
[superlog] Skip ERROR logging for client-disconnect AbortErrors in RPC interceptor#478superlog-app[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryAdds a single early-return guard in
Confidence Score: 4/5Safe to merge — the change is a minimal, targeted suppression of well-understood false-positive noise with no effect on how real server errors are handled. The guard is correct and the affected code path is narrow. The only open question is whether the equivalent unguarded catch block in handlers.ts could fire for AbortErrors during context creation, but that path is unlikely to be hit in practice. The outer try-catch in apps/api/src/rpc/handlers.ts (lines 58–67) is the only spot that might warrant a follow-up guard. Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Client (Browser)
participant E as Elysia (API)
participant R as RPCHandler
participant I as onError Interceptor
participant L as logOrpcHandlerError
C->>E: HTTP Request
E->>R: handle(request, context)
R->>R: Execute RPC procedure
C-->>R: Connection closed (AbortError)
R->>I: onError interceptor fires
I->>L: logOrpcHandlerError(AbortError)
Note over L: NEW: error.name === "AbortError"<br/>→ return early (no ERROR log)
L-->>I: return (silent)
R-->>E: RPCHandler returns response/error response
E-->>C: Response (if connection still open)
Reviews (1): Last reviewed commit: "[superlog] Skip ERROR logging for client..." | Re-trigger Greptile |
Summary
The API RPC interceptor logs
AbortError("The connection was closed.", code 20) at ERROR level whenever a browser closes a connection mid-request — navigation, tab close, page refresh. Every sample log showsstatus: 200, confirming the server already sent a successful response before the client disconnected. This produces false-positive ERROR incidents across all API endpoints.The root cause is that
logOrpcHandlerErrorinapps/api/src/rpc/interceptors.tsunconditionally callslogger.error(...)for every error without distinguishing client aborts from real server failures.This patch adds a single guard: if the error is an
AbortError(error.name === "AbortError"), return early rather than logging at ERROR. Real server errors continue to be logged as before.An alternative approach would be to log AbortErrors at DEBUG or INFO level instead of silently dropping them. The current patch drops them entirely since these events carry no actionable server-side signal; logging at DEBUG is a reasonable alternative if visibility into abort frequency is desired.
Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Skip ERROR logging for client-disconnect
AbortErrorin the API RPC interceptor to eliminate false error incidents when users navigate away or close tabs. All other errors continue to be logged at ERROR as before.Written for commit 8ffc97f. Summary will update on new commits.