Next.js 13 `app` directory support
See original GitHub issueWith version v0.5.2 we’ve added a createServerComponentSupabaseClient
which can be used server components to get an authenticated Supabase client. This is the PR which includes an example. Note that this needs to be used in combination with middleware as Next.js does not yet allow setting headers in server components.
Docs to follow soon.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:44 (8 by maintainers)
Top Results From Across the Web
Next.js 13: Working with the new app directory - LogRocket Blog
Explore the new features introduced in the Next.js 13 app directory ... The new app directory works alongside the pages directory to support...
Read more >App Directory Roadmap - Next.js beta docs
Section Feature Supported
React 18 Server Components ✓ Default
React 18 Client Components ✓ Opt‑in
React 18 Shared Components 🏗️
Read more >How the App Directory Works in Next.js 13 - MakeUseOf
Next.js 13 introduced a new routing system using the app directory. ... the app directory supports are server components and streaming.
Read more >Next.js 13 App Playground - Vercel
Explore the new app directory in Next.js 13. ... Suspense for Data Fetching: async / await support and the use hook for component-level...
Read more >[Feedback] App Directory in Next.js 13 #41745 - GitHub
However, upgrading to Next.js 13 does not require using the app directory. This discussion is where you can provide feedback on the new...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With version
v0.5.2
we’ve added acreateServerComponentSupabaseClient
which can be used server components to get an authenticated Supabase client. This is the PR which includes an example. Note that this needs to be used in combination with middleware as Next.js does not yet allow setting headers in server components.Docs to follow soon.
I spent some time yesterday and a bit today. Was able to use the existing
withMiddlewareAuth
function directly.In order to get access to a supabase client that is authenticated on the server, I am doing something like this:
Which I’m calling in my server component.
I don’t expect this to be a long term solution, and it doesn’t have the ability to set the cookies yet, but for authenticated requests I don’t need to at this point. Just wanted to give a quick progress update.
The Next 12 repo I’m working on is here: https://github.com/jensen/supabase-nextjs. I will push the Next 13 upgrade when I do some more testing.