Skip to content

Warning: @supabase/ssr: createServerClient was configured without the setAll cookie method - but it's definitely defined #110

@wiesson

Description

@wiesson

Bug report

Describe the bug

I receive the error message

@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.

But I'm using sveltekit and the setAll method is defined.

src/hooks.server.ts

event.locals.supabase = createServerClient<Database>(
  PUBLIC_SUPABASE_URL,
  PUBLIC_SUPABASE_ANON_KEY,
  {
      cookies: {
        getAll: () => event.cookies.getAll(),
        setAll: (cookiesToSet) => {
          cookiesToSet.forEach(({ name, value, options }) => {
            event.cookies.set(name, value, { ...options, path: '/' });
        });
      },
    },
  },
);

To Reproduce

Follow the tutorial on https://supabase.com/docs/guides/auth/server-side/sveltekit

Expected behavior

No error or warning is visible when using the code from the official examples

Screenshots

Image

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: latest
  • Version of Node.js: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions