Commit 5d54650
perf(auth): skip getUser() when no auth cookies present
The middleware was calling getUser() on EVERY request including unauthenticated
ones (bots, prefetches, public pages). This caused 13,000+ auth API requests
per hour with zero users, burning through Supabase rate limits.
Now checks for sb-* cookies first — if none exist, returns immediately without
hitting the Supabase Auth API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 69ea1a4 commit 5d54650
1 file changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
0 commit comments