Supabase and Prisma RLS policies

Hello,

I'm trying to implement RLS using this guide https://github.com/prisma/prisma-client-extensions/tree/main/row-level-security.

All went good until I've added the Prisma extension to bypass the RLS.

This supabase policy is for when I want to check the current_user_id:
(id = (current_setting('app.current_user_id'::text, true))::uuid)
.

However, when I try to query the database using the bypass policy, which doesn't set the current_user_id, I get the following error:

Error in batch request 1: Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "22P02", message: "invalid input syntax for type uuid: \"\"", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })
     at ni.handleRequestError (/Users/c/dv/deleplads/node_modules/@prisma/client/runtime/library.js:124:6989)
     at ni.handleAndLogRequestError (/Users/c/dv/deleplads/node_modules/@prisma/client/runtime/library.js:124:6206)
     at ni.request (/Users/c/dv/deleplads/node_modules/@prisma/client/runtime/library.js:124:5926) {
   clientVersion: '5.6.0'
 }


I've tried casting using something like
CAST((COALESCE(myfield,'some-uu-id-her-e')) AS uuid)
but that didn't work.
Was this page helpful?