nexus-plugin-prisma: compile error v 0.20

$ npm -s run generate:prisma && npm -s run generate:nexus Prisma Schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (version: 2.8.0) to ./node_modules/@prisma/client in 45ms

You can now start using Prisma Client in your code:

import { PrismaClient } from '@prisma/client'
// or const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()

Explore the full API: http://pris.ly/d/client

/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:91 let inputType = arg.inputType.some((a) => a.kind === ‘enum’) ^ TypeError: Cannot read property ‘some’ of undefined at transformArg (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:91:33) at Array.map (<anonymous>) at transformInputType (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:219:89) at /Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:53:46 at Array.map (<anonymous>) at transformSchema (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:53:35) at transform (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:28:13) at Object.exports.getTransformedDmmf (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:16:37) at new SchemaBuilder (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/builder.ts:256:7) at Object.build (/Users/mac/Desktop/server/node_modules/nexus-plugin-prisma/src/builder.ts:175:19)

since I updated to v 0.20 with prisma 2.8.0 I have this error

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 23
  • Comments: 19

Commits related to this issue

Most upvoted comments

These versions worked for me

"graphql": "^15.3.0",
"@prisma/client": "2.7.0",
"@prisma/cli": "2.7.0",
"@nexus/schema": "^0.16.0",
"nexus-plugin-prisma": "^0.20.0",

worked for me.

I just closed a PR to fix this: https://github.com/graphql-nexus/nexus-plugin-prisma/pull/876

OK, so after gave it try, it seems that I underestimate this, the core of the issue here is the Prisma Client 2.8.0 update breaks this 0.20.0 And this is just one fix among the all there are more than the eyes can see I updated prisma deps to 2.8 and building works, but there are 19 tests failing, and most of them are irrelevant to this change. We need a systematic update to Prisma 2.8 to resolve this issue, leave it to the team

_Originally posted by @Albert-Gao in https://github.com/graphql-nexus/nexus-plugin-prisma/pull/876#issuecomment-704661258_

If you really want to use 2.8 You can just apply the change from the PR to this file node_modules/nexus-plugin-prisma/dist/dmmf/transformer.js

but there could be bugs to other features

@ZaneH “graphql”: “^15.3.0”, => “14.7.0” so it is the same as yoga, helped me out

Got it working too with “graphql”: “14.7.0”, “@prisma/client”: “2.7.1”, “@prisma/cli”: “2.7.1”, “@nexus/schema”: “^0.16.0”, “nexus-plugin-prisma”: “0.20.0”,

I fixed this issue by changing this function:

https://github.com/graphql-nexus/nexus-plugin-prisma/blob/master/src/dmmf/transformer.ts#L91

The issue is the arg has property “inputTypes” with an S coming from Prisma Client, but transformArg() tries to access “inputType” without an S. If you add in the S to lines 91 - 96, the error is fixed.

I am not sure if the “correct” property name is plural or singular. Either Prisma Client needs to use singular or Nexus needs to reference plural.

These versions worked for me

"graphql": "^15.3.0",
"@prisma/client": "2.7.0",
"@prisma/cli": "2.7.0",
"@nexus/schema": "^0.16.0",
"nexus-plugin-prisma": "^0.20.0",