supabase: Set-Cookie header is ignored

Bug report

Describe the bug

Set-Cookie header is ignored in response from url: http://localhost:3000/auth/sign-in. The combined size of the name and value must be less than or equal to 4096 characters.

To Reproduce

Use the new supabase/ssr package

import { createServerClient, type CookieOptions } from "@supabase/ssr";
import { cookies } from "next/headers";

export const createClient = (cookieStore: ReturnType<typeof cookies>) => {
  return createServerClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
    {
      cookies: {
        get(name: string) {
          return cookieStore.get(name)?.value;
        },
        set(name: string, value: string, options: CookieOptions) {
          try {
            cookieStore.set({ name, value, ...options });
          } catch (error) {
            // The `set` method was called from a Server Component.
            // This can be ignored if you have middleware refreshing
            // user sessions.
          }
        },
        remove(name: string, options: CookieOptions) {
          try {
            cookieStore.delete({ name, ...options });
          } catch (error) {
            // The `delete` method was called from a Server Component.
            // This can be ignored if you have middleware refreshing
            // user sessions.
          }
        },
      },
    }
  );
};

Expected behavior

Should be able to set the cookie

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 5
  • Comments: 18 (2 by maintainers)

Most upvoted comments

I’m facing this issue as well. I’m not sure why this issue is closed, as the issue persists with the latest version. Is there any feasible workaround available?

It seems this is fixed with the lates supabase-ssr 0.1.0 release. šŸ‘šŸ»

Having the same issue with Facebook login, Google login works great but facebook loogin fails and the cookie error is showing in the console