Closed T-D3V closed 2 years ago
Do you have your nexus object definitions handy? I'm seeing this issue too when I try and create a field on the nexus schema mapping to another collection.
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
homes Home[]
}
model Home {
id String @id @default(auto()) @map("_id") @db.ObjectId
userId String @db.ObjectId
user User @relation(fields: [userId], references: [id])
}
import {User as PrismaUser} from 'nexus-prisma';
const User = objectType({
name: 'User',
definition: (t) {
t.field(PrismaUser.id);
t.field(PrismaUser.homes);
}
}
/Users/potter/workspace/taxes/server/node_modules/nexus/src/builder.ts:1743
return new Error(`${name} was already defined and imported as a type, check the docs for extending types`)
^
Error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type, check the docs for extending types
I found this issue when upgrading prisma you need to look for type ${yourmodel}OrderByInput in your graphql code generated
and change it to ${yourmodel}OrderByWithRelationInput
because OrderByInput not exist for the last prisma then you can restart your app and have a try
Getting same thing after attempting to migrate to nexus-prisma
from nexus-prisma-plugin
, not sure where to look
This bug means you are using a type that does not exist.
nexus
had an issue because it gives you NEXUS__UNKNOWN__TYPE
instead of the type name.nexus-prisma
nexus-prisma-plugin
t.crud
generated some inputs like XwhereInput,
XorderByInput
, and maybe you were using these inputs into your code when you move from nexus-prisma-plugin
to nexus-prisma
you will not have these types exist anymore so you will get an error.Can we close this issue @T-D3V or any update on this?
What do you define in your object types? @AhmedElywa is right this shouldn't be a bug its most likely you've define that object type more than once. comb through your code for a copy of name: '{model}'
to find the one that is a duplicate.
Yep I'll close it I mean this was from a few months ago and a lot has changed so no need to keep this issue open.
I have a nextjs project which uses graphql as a middleware api, following error occurs:
Error
package.json
Schema.prisma
Here's my file structure so you know what file to ask for if you need additional code.
So if you need aditional code feel free to ask me, but since I don't get why this error is happening. I don't even know what code to provide.
Thamks for the help.