[superlog] Silence AbortError in RPC interceptor error logger#493
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
|
| if (error instanceof Error && error.name === "AbortError") { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Silent drop vs. debug log: the
AbortError is currently discarded with no trace, which means there's no way to observe abort rates in verbose/debug log modes or correlate them with performance regressions. Logging at debug level (instead of return) would keep the ERROR incident feed clean while still allowing the signal to surface when needed.
| if (error instanceof Error && error.name === "AbortError") { | |
| return; | |
| } | |
| if (error instanceof Error && error.name === "AbortError") { | |
| useLogger().debug(error, { rpc: "interceptor", aborted: true }); | |
| return; | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
izadoesdev
left a comment
There was a problem hiding this comment.
Reviewed against staging. No code-level blockers found. This is a small targeted logging-noise fix: AbortError client disconnects are skipped before the RPC interceptor emits ERROR logs, while non-abort errors still flow through the existing error logger.
Note: this duplicates #478; I am treating #493 as the survivor because it is clean, green, and has clearer PR context. I will leave a tracking comment on #478 after this lands.
Summary
Client connection drops on RPC endpoints (user navigates away, closes a browser tab, or a mobile device goes to sleep mid-request) are logged as
ERRORby thelogOrpcHandlerErrorinterceptor. The error carriesname="AbortError"andcode=20(the standard DOM abort code), but the server had already processed the request successfully (HTTP 200, cache hit) before the network-level drop happened. This produces noisy false-positive incidents in Superlog with no user-facing failure behind them.The
logOrpcHandlerErrorfunction registered viaonError(...)on both the RPC and OpenAPI handlers logs every error unconditionally atERRORlevel. AnAbortErrorthat originates from the client side is indistinguishable from a real server error without an explicit name check.The fix adds an early return for errors whose
nameis"AbortError"before theuseLogger().error(...)call, silently dropping client abort noise while preserving full ERROR logging for all genuine server faults. An alternative approach would be to log atDEBUGinstead of dropping, which would keep the signal in verbose log modes without polluting the ERROR incident feed — either is reasonable if the team wants visibility into abort rates.Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Silences client-side AbortError noise in the RPC and OpenAPI error interceptor by skipping ERROR logs when a connection closes mid-request. Adds an early return in
logOrpcHandlerErrorto prevent false Superlog incidents while keeping logging for real server errors.Written for commit 2a0c841. Summary will update on new commits.