@supabase/server - v1.4.0
    Preparing search index...

    Function createContextClient

    • Creates a Supabase client scoped to the caller's context.

      Configured with a publishable key and (optionally) the caller's JWT, so Row-Level Security policies apply. Stateless — one client per request.

      With auth.keyName set, that named key from SUPABASE_PUBLISHABLE_KEYS is used — and it throws if the key doesn't exist. With keyName omitted, the default key is used, falling back to the first key in the set when no default exists.

      Note this differs from the "publishable" auth mode, which matches the default key only and never falls back — see index.AuthModeWithKey.

      Type Parameters

      • Database = unknown

      Parameters

      Returns SupabaseClient<Database>

      index.EnvError If SUPABASE_URL is missing or the specified publishable key is not found.

      const { data: auth } = await verifyAuth(request, { auth: 'user' })
      const supabase = createContextClient({
      auth: { token: auth.token, keyName: auth.keyName },
      })
      const { data } = await supabase.rpc('get_my_items')