You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Prisma model named Constructor which gave some problems in the past already as I cannot simply do prisma.constructor.findUnique({..}) because constructor here does not lead to the Prisma model..
I've worked around it by using prisma['Constructor'].findUnique({..}) and luckily this works; see below my Nexus Query type definition:
model Constructor {
id String @map("id") @id
name String @map("name")
countryId String @map("country_id")
country Country @relation(name: "ConstructorsByCountry", fields: [countryId], references: [id])
then I get the error:
{
"errors": [
{
"message": "The prisma model Constructor does not have a findUnique method available.",
"locations": [
{
"line": 4,
"column": 5
}
],
"path": [
"constructor",
"country"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: The prisma model Constructor does not have a findUnique method available.",
" at /workspace/my-project/node_modules/nexus-prisma/dist-cjs/generator/models/javascript.js:198:19",
" at field.resolve (/workspace/my-project/node_modules/apollo-server-core/dist/utils/schemaInstrumentation.js:56:26)",
" at executeField (/workspace/my-project/node_modules/graphql/execution/execute.js:479:20)",
" at executeFields (/workspace/my-project/node_modules/graphql/execution/execute.js:411:20)",
" at completeObjectValue (/workspace/my-project/node_modules/graphql/execution/execute.js:906:10)",
" at completeValue (/workspace/my-project/node_modules/graphql/execution/execute.js:633:12)",
" at /workspace/my-project/node_modules/graphql/execution/execute.js:484:9",
" at async Promise.all (index 0)",
" at async execute (/workspace/my-project/node_modules/apollo-server-core/dist/requestPipeline.js:205:20)",
" at async processGraphQLRequest (/workspace/my-project/node_modules/apollo-server-core/dist/requestPipeline.js:148:28)"
]
}
}
}
],
I guess it's related to issues I had myself earlier when accessing prisma.constructor.findUnique({..}) directly... instead of prisma['Constructor'].findUnique({..})...
How does the Nexus Prisma plugin access the models and could this something that gets fixed in the plugin?
Or is there maybe a workaround I can implement myself?
The text was updated successfully, but these errors were encountered:
Hi,
I have a
Prisma
model namedConstructor
which gave some problems in the past already as I cannot simply doprisma.constructor.findUnique({..})
becauseconstructor
here does not lead to the Prisma model..I've worked around it by using
prisma['Constructor'].findUnique({..})
and luckily this works; see below my NexusQuery
type definition:As I said this work and I can access both the
constructor
andconstructors
fields from GraphQL like:Where it stops working is when I want to query relations on the
Constructor
model...this is Nexus object definition:
and inside Prisma schema:
then I get the error:
I guess it's related to issues I had myself earlier when accessing
prisma.constructor.findUnique({..})
directly... instead ofprisma['Constructor'].findUnique({..})
...How does the Nexus Prisma plugin access the models and could this something that gets fixed in the plugin?
Or is there maybe a workaround I can implement myself?
The text was updated successfully, but these errors were encountered: