Upsert not working with Row Level Security

I am trying to setup an upsert for authenticated users. I have setup two row level policies, one is the insert for authenticated users only, the other is an update for authenticated users only. Couldn't get the update for authenticated users only to work, so testing out RLS for anonymous users as well, and I'm still getting the error

"new row violates row-level security policy for table "record""


when performing the update. Performing the insert works ok, but the update gives me the error.

My code is

const { error } = await supabase.from("record").upsert(
      [
        {
          masuk: 10,
          keluar: 10,
          stok: 100,
          company_name: "Acme Inc",
          alat_name: "MF 150",
        },
      ],
      {
        onConflict: "masuk,keluar,stok,company_name,alat_name",
      }
    );


The RLS for Update is attached
Screenshot_2024-01-05_at_10.24.20_PM.png
Was this page helpful?