S
Supabase9h ago
Ise

Supabase RLS with Prisma

I am creating a Dashboard with Next.js and I am considering using Prisma. I will need a lot of permissions to perform CRUD operations on the data. Does Prisma support Supabase RLS, or do I need to create DAL functions to run before performing CRUD operations with Prisma? Is it better to use Prisma at this point, or continue using the Supabase client and use RPC functions when I need to perform transactions or more complex queries?
1 Reply
garyaustin
garyaustin6h ago
The only way I've seen to do RLS with prisma that is compatible with RLS for the REST API is to some SQL set up the user role and set some Postgres settings with "JWT" info for auth.uid() and auth.jwt() to use. Otherwise you could just create your own RLS Postgres user and signin with that from Prisma. My observation is many use Prisma more for managing their SQL (migrations and such) versus just to use SQL. You could from a server use other SQL Postgres libraries if desired (same RLS issues though).

Did you find this page helpful?