Reputation: 23
I'm trying to delete a row in a supabase table via the javascript client api (also tried postman later). Supabase is running on a remote server via docker. I'm working with Next.js, but all cache has been disabled for a time being for testing purposes, so the issue cannot lie there.
Curiously, adding and modifying rows works. Only delete fails.
const { data, error } = await supabase.from("menus").delete().eq("id", "1");
if (error) {
console.error("Error deleting row:", error);
} else {
console.log("Row deleted:", data);
}
console.error(error);
According to the documentation, the above should work (the row with id=1 exists). Instead, it returns:
RLS is disabled. I tried using both the anon key and service_role key, with no success. Both roles have the superuser perms granted. Also given them perms to delete data.
I obviously checked the net and all the most common fixes, nothing worked.
EDIT
Upvotes: 0
Views: 1018
Reputation: 1
I had same issue and turns out if you have RLS policy enabled, with delete policy, you also need to create policy on select. I guess the logic is that if one can't read data, they neither can delete it.
Upvotes: 0