Description
Description and expected behavior
When trying to use CreateMandAndReturn API with a model that has an array, for example String[], I get the following exception:
Error calling enhanced Prisma method post.createManyAndReturn
:
Invalid prisma.post.findFirst()
invocation:
{
where: {
id: 1,
name: "bla",
expections: []
~~
}
}
Argument expections
: Invalid value provided. Expected StringNullableListFilter, provided ().
Steps to repro:
- Start a new zenstack project
- Schema model:
// This is a sample model to get you started.
/// A sample data source using local sqlite db.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Post {
id Int @id @default(autoincrement())
name String
expections String[]
@@allow('all', true)
}
index.ts file:
import { PrismaClient, Prisma } from "@prisma/client";
import { enhance } from '@zenstackhq/runtime';
const prisma = new PrismaClient();
const db = enhance(
prisma,
{},
{
kinds: ['delegate', 'policy'],
}
);
async function main() {
const query = await db.post.createManyAndReturn({
data: [
{
name: 'bla'
},
{
name: 'blu'
}
]
})
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
Try to run and u will get that error message
Environment (please complete the following information):
"devDependencies": {
"prisma": "6.2.x",
"typescript": "^5.7.3",
"zenstack": "2.11.1"
},
"dependencies": {
"@prisma/client": "6.2.x",
"@zenstackhq/runtime": "2.11.1"
}
Additional context
Add any other context about the problem here.