Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createServerClient deprecated? #358

Open
k-thornton opened this issue Jul 9, 2024 · 3 comments
Open

createServerClient deprecated? #358

k-thornton opened this issue Jul 9, 2024 · 3 comments

Comments

@k-thornton
Copy link
Contributor

Hey there! I'm noticing that this line has been marked deprecated in @supabase/ssr. It says the get/set/remove needs to be replaced with getAll/setAll and that the current method won't be supported in the next release. I haven't dug in much further but wanted to raise the issue here as soon as I noticed it.

https://github.com/vercel/nextjs-subscription-payments/blob/25a19504c85a2353f23e907521d0cdb1979c66d6/utils/supabase/server.ts#L10C10-L10C28

k-thornton added a commit to k-thornton/nextjs-subscription-payments that referenced this issue Aug 23, 2024
createServerClient has deprecated out get() and set() in favor of getAll() and setAll()

Supabase team has published the recommended replacement code, which I'm transplanting over here.  See
https://github.com/supabase/supabase/blob/e77f8b9f398a8436aa37f93b443620081211e1bc/apps/docs/content/guides/auth/server-side/nextjs.mdx?plain=1#L221-L283

Solves vercel#358
@k-thornton
Copy link
Contributor Author

Ported the latest code over from the Supabase docs and opened a PR :)

@SgtErnestBilko
Copy link

SgtErnestBilko commented Oct 30, 2024

I have updated my middleware (updateSession) as suggested. I am getting intermittent 502 errors, which I can resolve by deleting cookies for the site and re-logging on. When in the 502 'dead-end', if I comment out

cookiesToSet.forEach(({ name, value, options }) =>
            supabaseResponse.cookies.set(name, value, options),
          );

The 502 error disappears and the page renders. I have spent hours trying to catch errors in ever more granular ways but I'm none the wiser. Every solution involves preventing a set cookies call in some way.

I am going to open a discussion in supabase '502 Errors with updated createServerClient code', so as not to hijack this thread.

@SgtErnestBilko
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants