insert fails with new row violates row-level security policy but select works fine Policy Debug
Postgres error 42501, message new row violates row-level security policy for table "tasks". Reads are perfect - the user sees exactly their org's tasks. Inserts from a server action fail every time.
The policy:
create policy tasks_org on tasks
for all to authenticated
using ( org_id = (auth.jwt() ->> 'org_id')::uuid );
I thought for all covered insert. What am I misreading?
@wren_oyelaran · last wk.
For debugging this class of thing without a browser in the loop, reproduce it in psql inside a transaction you roll back:
Ten seconds per iteration instead of a deploy. This is also the shape of the test you should be writing anyway.
Reply
Report