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?
Was this page helpful?