event.locals.supabase type error

I am getting this error on my SvelteKit Auth SSR Setup. Note that this setup was from the official documentation and was working fine until now (https://supabase.com/docs/guides/auth/server-side/sveltekit):
Type 'SupabaseClient<Database, "public" | "__InternalSupabase" | "graphql_public", GenericSchema, never, { PostgrestVersion: "12.2.12 (cd3cf9e)"; }>' is not assignable to type 'SupabaseClient<Database, "public", "public", { Tables: { expenses: { Row: { amount: number; category: string; created_at: string; id: string; name: string; note: string | null; status: string | null; updated_at: string; }; Insert: { ...; }; Update: { ...; }; Relationships: []; }; ... 5 more ...; vehicles: { ...; }; ...'.
Type 'GenericSchema' is not assignable to type '"public"'.ts(2322)
Type 'SupabaseClient<Database, "public" | "__InternalSupabase" | "graphql_public", GenericSchema, never, { PostgrestVersion: "12.2.12 (cd3cf9e)"; }>' is not assignable to type 'SupabaseClient<Database, "public", "public", { Tables: { expenses: { Row: { amount: number; category: string; created_at: string; id: string; name: string; note: string | null; status: string | null; updated_at: string; }; Insert: { ...; }; Update: { ...; }; Relationships: []; }; ... 5 more ...; vehicles: { ...; }; ...'.
Type 'GenericSchema' is not assignable to type '"public"'.ts(2322)
hooks.server.ts (error scope) :
event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, {
cookies: {
getAll: () => event.cookies.getAll(),
/**
* SvelteKit's cookies API requires `path` to be explicitly set in
* the cookie options. Setting `path` to `/` replicates previous/
* standard behavior.
*/
setAll: (cookiesToSet) => {
cookiesToSet.forEach(({ name, value, options }) => {
event.cookies.set(name, value, { ...options, path: '/' });
});
}
}
});
event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, {
cookies: {
getAll: () => event.cookies.getAll(),
/**
* SvelteKit's cookies API requires `path` to be explicitly set in
* the cookie options. Setting `path` to `/` replicates previous/
* standard behavior.
*/
setAll: (cookiesToSet) => {
cookiesToSet.forEach(({ name, value, options }) => {
event.cookies.set(name, value, { ...options, path: '/' });
});
}
}
});
No description
No description
3 Replies
silentworks
silentworksβ€’2w ago
These are typescript errors, so it could be that you've upgraded library version since the last time it was working or sometimes your IDE needs to be restarted for these errors to go away.
`π˜Όπ™’π™žπ™œπ™€
Hmm, these are my typescript and supabase version/s. I also tried restarting IDE but it did not work: "@supabase/ssr": "^0.6.1", "@supabase/supabase-js": "^2.52.1", "typescript": "^5.0.0", "typescript-eslint": "^8.20.0",
Fieryduck82579
Fieryduck82579β€’2w ago
Try deleting the .svelte-kit folder. It will automatically be regenerated.

Did you find this page helpful?