How to Migrate from Supabase Auth Helpers to SSR package #27849
ssudaraka
announced in
Troubleshooting
Replies: 1 comment
-
Supabase SSR in NextJS Middleware is not compatible with NextJS 15. Cookies are not being saved because Supabase is not correctly handling cookies that are differently handled in NextJS 15. We had to downgrade React dependencies to latest 18 version Would we be able to get the examples and documentation updated to work with NextJS 15 + React 19? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
auth-helpers
packages are being deprecated and replaced with the@supabase/ssr
package. We recommend migrating to the@supabase/ssr
package as future bug fixes and feature releases are focused on the@supabase/ssr
package.Here are the steps for you to migrate your application from the
auth-helpers
package to@supabase/ssr
package.Depending on your implementation, you may ignore some parts of this documentation and use your own implementation (i.e. using API routes vs. Server Actions). What’s important is you replace the clients provided by
auth-helpers
with the utility functions created using clients provided by@supabase/ssr
.1. Uninstall Supabase Auth Helpers and install the Supabase SSR package
It’s important that you don’t use both
auth-helpers-nextjs
and@supabase/ssr
packages in the same application to avoid running into authentication issues.2. Create the utility functions to create Supabase clients.
3. Replace your middleware.ts file
4. Create your Server Actions to handle Login and Sign up.
5. Utilize the server actions in your Login page UI.
6. Client Components
7. Server Components
8. Route Handlers
Likewise, you can replace the clients created with
@supabase/auth-helpers-nextjs
with utility functions you created with@supabase/ssr
.createMiddlewareClient
→createServerClient
createClientComponentClient
→createBrowserClient
createServerComponentClient
→createServerClient
createRouteHandlerClient
→createServerClient
You can find more clear and concise examples of creating clients in our documentation here.
If you have any feedback about this guide, please provide them as a comment below. If you find any issues or have feedback for the
@supabase/ssr
client, please post them as an issue in@supabase/ssr
repo.As always, our GitHub community and Discord channel are open for technical discussions and resolving your issues.
Beta Was this translation helpful? Give feedback.
All reactions