Skip to content

fix(backend): stop logging rejected requests as errors - #62

Merged
b-sw merged 1 commit into
mainfrom
fix/backend-4xx-log-level
Nov 8, 2026
Merged

b-sw merged 1 commit into
mainfrom
fix/backend-4xx-log-level

Conversation

@b-sw

@b-sw b-sw commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Problem

AllExceptionsFilter logs every HttpException as an Unhandled Exception error. 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

  • Log 4xx responses at http level as Request rejected, with no stack.
  • Keep 5xx responses and crashes as Unhandled Exception errors, with a stack.
  • Add a warn entry 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.ts checks the log level for a 401 and for a crash.
  • test/refresh-token/writes.spec.ts checks the reuse warning and that reuse ends the session.
  • Both specs fail on the old source and pass on the new source.
  • pnpm test passes (205 tests). pnpm build passes.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cryptly Ready Ready Preview Nov 8, 2026 10:22am UTC

@b-sw
b-sw merged commit ed82d61 into main Nov 8, 2026
3 checks passed
@b-sw
b-sw deleted the fix/backend-4xx-log-level branch November 8, 2026 10:24

This branch was successfully deployed

1 active deployment
Preview — 262073e9 Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant