RLS Policies exist but error 403 persists and I'm getting denied.
Building and app and the goal is to get an education modal where users can see, edit, upload, and delete their education data, I have the correct policies (think I do at least, you never know)
I can link my education.tsx, and my educationService.ts if that would make things easier, I have been working on this issue for while.

29 Replies
Check the API and Postgres logs.
But permission denied is usually a grant issue and not an RLS issue.
What operation is getting the error.
An insert RLS error is usually this message:
new row violates row-level security policy for table xxxxx
this is on api gateway
sorry i would be more detailed but this is my first supabased project
That is a select.
It would not error for RLS
So somehow your public schema or that tables grants got changed.
i restarted workiong on my policies, rn i just have

Are you using Prisma?
nah
Polices are not your issue.
gotcha
Are you using an AI?
like in the project, no
not implimenting an ai
For generating database code?
yeah about 70% of it
My thinking is either it did, or it had you run some SQL to change tables or schema with the GRANT operation.
is there a way to check?
grant select, insert, update, delete on education to authenticated;
i just ran this
and it
the error is gona
Yeah not good if you don't know why...
iv used
the same database, for a lot of projects,
i think i must have changed grant permissions a while backl
Could have modified the grants for other tables and roles.
i think i def did
is there a way to reset it to defaulkt
If you don't need grants to block for some reason I can find the SQL code to reset it all to what SB comes with.
i think i keep them
thank you sm
this issue has been abs killing me
Would reset them to default.
is this better to do, cuz i got my auth working and dont wanna ruin it
You could wait until the next thing breaks and then do it.
The only downside is if you have some code you wanted to hide form a particular user. Normally you should use RLS for that on tables though.
does grant disable rls?
It is checked first, then RLS is checked.
so if I wanna build this for safety whats the best practice methodology to do
can i grant only to authenticated users
I would personally never touch the public grants for tables. I might for specific functions. I use RLS or I use a custom schema where I set the grants as I want. But leave public alone.
alr so i should jusit set them to default then, i think i changed them earlier