AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Update Supabase UI Next.Js Auth Docs To Use Proxy.Ts For Next.Js 16

Password-based auth guide still uses legacy middleware.ts pattern, causing breakage in Next.js 16; docs must be updated to proxy.ts.

mediumConfidence 82%Next.jsnext buildServer Actions

Origin Analysis

The guide was written for Next.js 15, where middleware.ts is the convention. Next.js 16 renamed the middleware file to proxy.ts and changed the export signature, so the old code is ignored and authentication session refresh fails.
1. Create a new Next.js 16 project. 2. Install @supabase/ssr and supabase-ui. 3. Follow the password-based auth guide at https://supabase.com/ui/docs/nextjs/password-based-auth. 4. Create a file named middleware.ts as shown in the guide. 5. Run the dev server and attempt to sign in or access a protected page. 6. Observe that middleware does not run (session refresh fails, protected routes not enforced).

Fixing Code Block

import { createServerClient } from '@supabase/ssr' import { NextResponse, type NextRequest } from 'next/server' export default async function proxy(request: NextRequest) { let response = NextResponse.next({ request: { headers: request.headers, }, }) const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { get(name: string) { return request.cookies.get(name)?.value }, set(name: string, value: string, options: any) { request.cookies.set({ name, value, ...options }) response = NextResponse.next({ request: { headers: request.headers }, }) response.cookies.set({ name, value, ...options }) }, remove(name: string, options: any) { request.cookies.set({ name, value: '', ...options }) response = NextResponse.next({ request: { headers: request.headers }, }) response.cookies.delete(name) }, }, } ) const { data: { user } } = await supabase.auth.getUser() if (!user && request.nextUrl.pathname.startsWith('/protected')) { const url = request.nextUrl.clone() url.pathname = '/login' return NextResponse.redirect(url) } return response }
Replace the legacy middleware.ts with proxy.ts and export a default async proxy function. Use createServerClient from @supabase/ssr with manual cookie handling for request/response cookies, which is the recommended pattern for Next.js 16 and avoids the deprecated middleware convention.

Edge Case Audit

This is a documentation-only fix. If you are still on Next.js 15, keep using middleware.ts. When migrating to Next.js 16, rename the file and update the export signature. Rollback: revert file name and export to middleware.ts if downgrading to Next.js 15. Edge runtime restrictions apply; avoid Node-specific imports.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state