Skip to content

Commit 4af7040

Browse files
Kikolatorclaude
andauthored
fix: bypass middleware auth for webhook endpoints (#82)
## Summary - Stripe webhook POST requests were intercepted by middleware and redirected to `/login` (no user session), returning 401 to Stripe - Added `/api/webhooks/` to the middleware bypass list alongside `/api/health` - Combined with registering the Stripe endpoint as a **Connect** webhook (done in Stripe dashboard), this fixes zero webhook delivery for member signup/payment flows ## Test plan - [ ] Deploy to dev preview - [ ] Send test event from Stripe Connect webhook endpoint → expect 200 - [ ] Full signup + payment flow → verify credits appear in member account 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4ab3ea1 commit 4af7040

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/web/middleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export async function middleware(request: NextRequest) {
2222
const hostname = request.headers.get("host") ?? "";
2323
const { pathname } = request.nextUrl;
2424

25-
// Let the health-check endpoint through without auth or space resolution
26-
if (pathname === "/api/health") {
25+
// Let health-check and webhook endpoints through without auth or space resolution
26+
if (pathname === "/api/health" || pathname.startsWith("/api/webhooks/")) {
2727
return NextResponse.next();
2828
}
2929

0 commit comments

Comments
 (0)