Skip to content

Generated "enhance" function not found. Please run zenstack generate first. #2146

@Tsimopak

Description

@Tsimopak

Description and expected behavior
I got an exception of Generated "enhance" function not found. Please run zenstack generate first. even though i did zenstack generate.

Steps to reproduce:

  1. mkdir new folder
  2. npm init -y
  3. npm i -D typescript
  4. npx tsc --init
  5. npx zenstack init
  6. npx zenstack generate && npx prisma db push
  7. make an index.ts file with:
import { PrismaClient } from '@prisma/client';
import { enhance } from '@zenstackhq/runtime';

const prisma = new PrismaClient();

  const db = enhance(
    prisma,
    {
    },
    {
      kinds: ['delegate', 'policy'],
    }
  );
  1. npx tsx ./index.ts

Environment (please complete the following information):

"devDependencies": {
"prisma": "6.8.x",
"typescript": "^5.8.3",
"zenstack": "2.15.1"
},
"dependencies": {
"@prisma/client": "6.8.x",
"@zenstackhq/runtime": "2.15.1"
}

I tried both with postgresql and sqlite

EDIT: I think that it seems to be an issue with tsx library, because when i do npx tsc index.ts and then run node index.js it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions