Why admin client faces with "Auth session missing!"

My admin client:
import { Database } from "./database-generated.types";
import { createClient as createServerClient } from "@supabase/supabase-js";

export function createClient() {
  return createServerClient<Database>(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ADMIN_KEY!,
    {
      auth: {
        persistSession: false,
        autoRefreshToken: false,
        detectSessionInUrl: false,
      },
    }
  );
}


do not avoid this policy
alter policy "update_charities_owner_only"
on "public"."charities"
to authenticated
using (
  ((( SELECT auth.jwt() AS jwt) ->> 'email'::text) = (email)::text)
);


as I know admin must avoid these policies
Was this page helpful?