Issue with Prisma + Read-only User Permissions
I'm facing a specific issue with Prisma ORM integration and custom Supabase user permissions.
The Problem:
- I created a custom read-only database user in Supabase for production security
- Prisma can generate types successfully but cannot execute read queries like await prisma.SOME_MODEL.findMany() when using this restricted user's credentials (Error querying the database: FATAL: Tenant or user not found)
- This forces me to use a full-access user in production, which is a security concern
Current Workaround:
- Using full database access "on trust" that developers won't misuse it
- But I want proper permission-based security, not trust-based
Questions:
- Is there a way to make Prisma work with read-only database users?
- Any other security best practices for this scenario?
16 Replies
https://github.com/orgs/supabase/discussions/34455 might be worth seeing if this discussion thread is relevant to you
GitHub
Unable to use a readonly user · supabase · Discussion #34455
Hello, I am using supabase in my application. I want to create a read only user for general debugging and usage. But I am unable to make it work. I either get a Tenant or user not found error or a ...
@ihm40 nice, but where i can find supabase_read_only_user password? 🙂
it is a supabase manage role i belive, if you go into Database -> roles you will see
supabase_read_only_user
as a roleyes i see, but i cant use it without password
what do you mean without password? I think every role will require the db password to be set in the connection
it is not possible to see it and change it


what would you want to change?
I want to change my supabase_read_only_user password, it's a desperate desire, because I don't know how to see or find out my supabase_read_only_user password.
right okay, i think i understand. You want to create a supabase user with a different password to the current database password and give only read permissions to that user?
in general - yes
I don't know how how to do that (via supabase UI at least), maybe you could do it via SQL queries but i would be careful with that
I already created such a user through SQL, but it didn't help, as in the link you provided, the only possible way is to use the user that superbase_read_only itself provides, but I have no idea what its password is.
i am looking at this guide
Postgres Roles and Privileges
A guide to Postgres roles and privileges
and it seems like the password should have been set when you created the user?
I know how roles are created, that wasn't the question.
I solved the problem, thanks for taking the time and providing the link, I just now noticed that me need to insert it even for custom instanceID users