Skip to content

Prisma Enhancer: Cannot find prisma-client-js generator when using type instead of model for auth() #2135

@luxquant

Description

@luxquant

Description:

I'm getting the following error when running zenstack generate:

Prisma Enhancer: Cannot find prisma-client-js generator in the schema

However, I do have a generator client block in my schema:

generator client {
  provider = "prisma-client"
  runtime = "node"
  moduleFormat = "cjs"
  output = "../src/generated/prisma"
}

More importantly, the issue seems to be triggered only when I use a type for the user definition (as suggested in the documentation):

type User {
  id   String   @id
  role UserRole

  @@auth
}

If I switch it to a model, the error disappears — but I don't want to store users in the database, as I'm using an external auth service.


Expected behavior:

Since the [documentation](https://zenstack.dev/docs/the-complete-guide/part1/access-policy/current-user) explicitly supports using type instead of model for describing the shape of auth(), this setup should be valid and should not break enhancer generation.


Reproduction:

  1. Use a minimal schema with type User { @@auth }
  2. Run zenstack generate
  3. Observe the Enhancer error even if generator client is defined

Versions:

  • database: Postgres
  • @zenstackhq/runtime: 2.15.0
  • prisma: 6.8.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions