Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't use prisma studio because zenstack roles !! #1977

Open
issam-seghir opened this issue Feb 5, 2025 · 2 comments
Open

Can't use prisma studio because zenstack roles !! #1977

issam-seghir opened this issue Feb 5, 2025 · 2 comments

Comments

@issam-seghir
Copy link

Description and expected behavior
when i open prisma studio to see my tables i can't access any table and get permission error

Screenshots

Environment (please complete the following information):

  • ZenStack version: 2.4.1
  • Prisma version: 5.18.0
  • Database type: Postgresql 17.1

Message: Error in Prisma Client request:

Invalid `prisma.user.findMany()` invocation:


User `johndoe` was denied access on the database `mydb.public`
  
Query:
{
  "modelName": "User",
  "operation": "findMany",
  "args": {
    "take": 100,
    "skip": 0,
    "select": {
      "id": true,
      "username": true,
      "firstName": true,
      "lastName": true,
      "email": true,
      "password": true,
      "gender": true,
      "birthDate": true,
      "country": true,
      "state": true,
      "role": true,
      "phone": true,
      "profilePic": true,
      "coverImg": true,
      "isEmailVerified": true,
      "isDisabled": true,
      "isDeleted": true,
      "tokens": {
        "select": {
          "id": true
        }
      },
      "admin": true,
      "supervisor": true,
      "teacher": true,
      "student": true,
      "createdAt": true,
      "updatedAt": true,
      "deletedAt": true
    }
  }
}
@ymc9
Copy link
Member

ymc9 commented Feb 5, 2025

Hi @issam-seghir , ZenStack's access control only kicks in when you explicitly create an enhanced PrismaClient with the enhance API. Prisma studio uses raw PrismaClient. Could it be a database permission issue?

@issam-seghir
Copy link
Author

I don't know; this is the first time this has happened to me, and it only occurs in the project where I use Zenstack. The only thing that works for me is specifying which environment variable to use for both prisma generate and prisma studio commands
dotenv -e .env.development.local -- prisma studio

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants