Skip to content

[BUG] Cannot CreateManyAndReturn with a model that has array of string #1955

Closed
@Tsimopak

Description

@Tsimopak

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:

  1. Start a new zenstack project
  2. 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.

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