© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
3 replies
leapy8124

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)
(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'
 }
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)
CAST((COALESCE(myfield,'some-uu-id-her-e')) AS uuid)
but that didn't work.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase - RLS Policies Issues
SupabaseSSupabase / help-and-questions
13mo ago
Supabase RBAC and RLS policies performance
SupabaseSSupabase / help-and-questions
3y ago
RLS policies
SupabaseSSupabase / help-and-questions
13mo ago
Supabase RLS with Prisma
SupabaseSSupabase / help-and-questions
4mo ago