Skip to content

error with createMany on generated client - v2 #1149

@andrewkucz

Description

@andrewkucz

Description and expected behavior

Hi, another small issue I found-

It seems createMany isn't working with the generated client, or at least the TS types are incorrect. This is the error I get.

invalid `db[model].create()` invocation in
/.../node_modules/@zenstackhq/runtime/enhancements/delegate.js:340:44

  337 if (this.options.logPrismaQuery) {
  338     this.logger.info(`[delegate] \`create\` ${this.getModelName(model)}: ${(0, utils_1.formatObject)(args)}`);
  339 }
→ 340 const result = yield db[model].create({
        rank: 1,
        ~~~~
        entityId: "cltvkqusu00084fz087jqxaan",
        userId: "cltlxxg6m000013legrdssavr",
        note: "",
      ? data?: UserRankingCreateInput | UserRankingUncheckedCreateInput
      })

Unknown argument `rank`. Did you mean `data`? Available options are marked with ?.

It looks like internally it is passing the data directly to create(...) instead of to the data field create({ data: ... }).

I verified this by changing my createMany to look like createMany({ data: [ { data: ... } ] }) and it did work, however TS believes it is incorrect.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • ZenStack version: 2 alpha 7
  • Prisma version: 5.11
  • Database type: Postgresql

Let me know if you want a more detailed example / repro

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions