nexus-plugin-prisma icon indicating copy to clipboard operation
nexus-plugin-prisma copied to clipboard

Property '<MODEL>UpdateManyDataInput' does not exist on type 'NexusGenInputs'

Open narciero opened this issue 4 years ago • 6 comments

Issue

I am getting the following error (screenshot) when nexus-prisma tries to generate types for my schema.

Screen Shot 2020-04-07 at 7 47 21 PM

Steps to reproduce

I have created a very simple repro here: https://github.com/narciero/nexus-prisma-bug-repro

Just pull the code down and run the build command.

Schema

You can view this in the repro repo, but here is my schema

datasource db {
  provider = "postgresql"
  url      = ""
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id      String   @default(cuid()) @id
  profile Profile?
}

model Profile {
  userId String @id
  user   User   @relation(fields: [userId], references: [id])
  info   Info   @relation(fields: [infoId], references: [id])
  infoId String
  // test String // if I just add this dummy field, everything works again
}

model Info {
  id       String    @id
  profiles Profile[]
}

Thoughts

The issue seems to be caused by the Profile model not having any fields other than the 2 relations to User and Info. For some reason, this is causing nexus-prisma to not generate some of the Input types that are required in Typescript (causing tsc to fail).

What's interesting is if you just add a dummy scalar field to the Profile model, everything works fine - seems like some kind of bug in the typegen system.

narciero avatar Apr 08 '20 00:04 narciero

Also facing this issue. Also @narciero thanks for the dirty fix, would have pulled my hair out debugging without that!

hatchli avatar Aug 07 '20 17:08 hatchli

I also have the issue

AssisrMatheus avatar Aug 12 '20 19:08 AssisrMatheus

how about this? I'm facing this issue when create explicit many-to-many relation in prisma.

bolerap avatar Dec 22 '20 08:12 bolerap

I asked about similar bug on stackoverflow 10 months ago:

https://stackoverflow.com/questions/61449315/input-object-type-xxx-must-define-one-or-more-fields-in-prisma-2-0/66589194#66589194

@lockednlevered mentioned that this is issue connected with my problem.

It can be useful to see two different steps to reproduction.

gustawdaniel avatar Mar 13 '21 16:03 gustawdaniel

Facing this issue too.

cufarvid avatar Apr 11 '21 21:04 cufarvid

Was facing this same issue. Thanks @narciero

jakegiri avatar Oct 17 '21 21:10 jakegiri