Repository navigation
fix(backend): stop logging rejected requests as errors - #62
Merged
Merged
Conversation
Every HttpException reached Logdash as an "Unhandled Exception" error, including the 401 that an idle tab gets when a stream reconnects with an expired access token. The client refreshes and retries, so nothing is wrong, but open tabs filled the error logs. Log 4xx at http level without a stack. Keep 5xx and crashes as errors. Refresh token reuse was only visible through the old error log, so it now has its own warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
AllExceptionsFilterlogs everyHttpExceptionas anUnhandled Exceptionerror. This includes normal 4xx responses.Open tabs hold event streams. When a stream reconnects after the 15-minute access token expires, the API returns 401. The client then refreshes the token and retries, so users see no problem. Each open tab still logs error entries with a stack on every cycle.
Change
httplevel asRequest rejected, with no stack.Unhandled Exceptionerrors, with a stack.warnentry for refresh token reuse. This possible-theft signal was visible only through the old error log. The entry contains the user ID and no token.Tests
test/logging/exception-logging.spec.tschecks the log level for a 401 and for a crash.test/refresh-token/writes.spec.tschecks the reuse warning and that reuse ends the session.pnpm testpasses (205 tests).pnpm buildpasses.🤖 Generated with Claude Code