© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4mo ago•
8 replies
giroldo

Next.js Supabase example fails with local Supabase instance (middleware returns null)

The supabase's nextjs example works if I connect a supabase's hosted project, but when I try o connect with my local development env, the middleware (now it's called proxy with the new version of nextjs) returns null at line 47 (the file is lib/supabase/middleware.ts)

To Reproduce

1. pnpm create next-app@latest -e with-supabase
2. npx @next/codemod@canary middleware-to-proxy .
3. pnpm approve-builds
4. pnpm add -D supabase
5. pnpm supabase init
6. pnpm supabase start
7. Put the supabase url and publishable key inside .env.local
8. Create an account at supabase local dashboard
Try to login and access /protected route
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Next.js middleware with @supabase/ssr: auth.getUser() returns null even when auth cookie exists
SupabaseSSupabase / help-and-questions
4mo ago
Reset local Supabase instance?
SupabaseSSupabase / help-and-questions
4y ago
Supabase MCP local fails
SupabaseSSupabase / help-and-questions
3mo ago
Supabase with Next.js 13
SupabaseSSupabase / help-and-questions
4y ago