Skip to content

Commit bb39fd5

Browse files
felmononclaude
andcommitted
Add missing Next.js middleware to wire up Supabase auth session handling
The updateSession helper existed in src/lib/supabase/middleware.ts but was never connected to Next.js. Without this file, auth cookies were not refreshed on navigation, causing authenticated users to be redirected back to the landing page after login. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6e9fa38 commit bb39fd5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/middleware.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { type NextRequest } from 'next/server';
2+
import { updateSession } from '@/lib/supabase/middleware';
3+
4+
export async function middleware(request: NextRequest) {
5+
return await updateSession(request);
6+
}
7+
8+
export const config = {
9+
matcher: [
10+
/*
11+
* Match all request paths except:
12+
* - _next/static (static files)
13+
* - _next/image (image optimization files)
14+
* - favicon.ico (favicon file)
15+
* - Public assets (svg, png, jpg, etc.)
16+
*/
17+
'/((?!_next/static|_next/image|favicon\\.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
18+
],
19+
};

0 commit comments

Comments
 (0)