Why auth.uid() returns null in Supabase RLS when using Clerk
auth.uid() is null because Supabase is verifying a JWT that isn't signed with your Supabase JWT secret — usually a raw Clerk session token. Bridge Clerk → Supabase with a signed Supabase-compatible JWT (or the official third-party auth integration), then RLS sees a real uid.
Why it happens
Supabase RLS helpers like auth.uid() read claims from the JWT attached to the request. Clerk's session token is a valid JWT for Clerk — not for Supabase. If you pass getToken() straight into createClient({ global: { headers: { Authorization }}}) without minting a Supabase-shaped token (or enabling Clerk as a third-party auth provider), PostgREST accepts the connection as anon and auth.uid() resolves to null. The seam is the audience/issuer mismatch, not your RLS SQL.
Env-var matrix
Variable · which dashboard · publishable / secret / signing · differs per environment?