Skip to content

fix: add granular auth error types for better debugging#161

Merged
arpandhakal merged 3 commits intomainfrom
fix/improve-auth-error-types
Mar 20, 2026
Merged

fix: add granular auth error types for better debugging#161
arpandhakal merged 3 commits intomainfrom
fix/improve-auth-error-types

Conversation

@foleyatwork
Copy link
Collaborator

Summary

  • AssemblyNoTokenError was used for three different failure modes, making it impossible to diagnose auth issues from logs
  • Adds AssemblyTokenParseError — token is present in the URL but fails Zod validation (empty string, wrong format)
  • Adds AssemblyMissingHeadersError — proxy didn't inject auth headers, so server components can't authenticate
  • Adds structured logging with context (token type, length, URL path, search param keys) to each error path
  • Page components now throw AssemblyMissingHeadersError instead of AssemblyNoTokenError since they check headers, not query params

Test plan

  • Load app with valid token — should work as before
  • Load app with no ?token= param — should see AssemblyNoTokenError in logs with URL context
  • Load app with empty ?token= — should see AssemblyTokenParseError in logs
  • If proxy fails to set headers — should see AssemblyMissingHeadersError in logs

🤖 Generated with Claude Code

@foleyatwork foleyatwork self-assigned this Mar 19, 2026
@vercel
Copy link

vercel bot commented Mar 19, 2026

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

Project Deployment Actions Updated (UTC)
client-home-v3 Ready Ready Preview, Comment Mar 20, 2026 1:13am

Request Review

Kevin Foley and others added 3 commits March 20, 2026 06:57
AssemblyNoTokenError was used for three different failure modes,
making it impossible to tell from logs whether the token was missing,
unparseable, or if the proxy failed to inject headers. Adds
AssemblyTokenParseError and AssemblyMissingHeadersError to
distinguish between these cases, with structured logging on each.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
getImageUrl was returning URLs with token= (empty) and
filePath=undefined when called before the app-bridge had received a
token or when banner path was undefined. The browser would fetch these
broken URLs, the proxy would throw AssemblyNoTokenError, and the
Server Components render would crash — killing the whole page.

Now returns undefined when token or path is missing, with logging to
help diagnose why the token isn't available. All callers updated to
skip rendering Banner when no valid URL is available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arpandhakal arpandhakal force-pushed the fix/improve-auth-error-types branch from 1ed7898 to 1d920c6 Compare March 20, 2026 01:13
@arpandhakal arpandhakal merged commit 680c441 into main Mar 20, 2026
3 of 4 checks passed
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.

2 participants