$ 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 ()
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 ()
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
I am experiencing the same error! Just downgrade to prisma 2.7.0. The current versions seems not to work with prisma 2.8.0
after downgrading to prisma 2.7.0, cleaning the yarn cache, re installing dependencies, i'm experiencing the exact same issue
I ran into this issue yesterday and it has only gotten stranger. My project is on hold until I can fix it.
I am also having troubles downgrading:
yarn cache clean
rm -rf node_modules ../../node_modules
yarn install
yarn generate
What do you use: The nexus framework nexus or the old @nexus/schema package? Please be aware, that version 0.20 removed the nexus framework support. Also, see the announcement here: https://github.com/prisma-labs/graphql-framework-experiment/issues/1432
And make sure, that following dependencies are installed:
@nexus/schema (NOT nexus.): 0.15.0
@prisma/client: 2.7.0
graphql: 14.6.0
Please make sure, to not accidentally define a range through ~ or ^.
If you still use the nexus framework, please have a look at the following migration guides:
https://nexusjs.org/docs/adoption-guides/nexus-framework-users
https://nexusjs.org/docs/adoption-guides/neuxs-framework-prisma-users
Im having the same issue as @navigui
Same error appears on latest version of nexus/schema; prisma; graphql and on the recommended versions:
@nexus/schema 0.15.0
@prisma/client: 2.7.0
graphql 14.6.0
TypeError: Cannot read property 'some' of undefined
at transformArg (node_modulesnexus-plugin-prisma\src\dmmf\transformer.ts:91:33)
@bb-art have you tried downgrading @prisma/cli to 2.7.0 as well ? I could fix it on wsl2 downgrading both cli and client
@JustinVoitel Yes, already did that on windows. I'll give it a try on linux
@valentinpalkovic @JustinVoitel Thanks, pinning both packages (hard) and removing nexus resolved this issue for me.
It doesn't seem to matter how far back in my commit history I go,
yarn generate refuses to work anymore
{
"name": "@redacted/backend",
"version": "1.0.0",
"scripts": {
"generate": "npm -s run generate:prisma && npm -s run generate:nexus",
"generate:prisma": "prisma generate",
"generate:nexus": "ts-node --transpile-only src/schema",
"dev": "ts-node-dev --no-notify --respawn --transpileOnly src/server",
"codegen": "graphql-codegen --config codegen.yml",
"seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@nexus/schema": "0.15.0",
"@paypal/checkout-server-sdk": "^1.0.2",
"@prisma/client": "2.7.0",
"@sendgrid/mail": "^7.2.6",
"@sentry/node": "^5.24.2",
"@sentry/tracing": "^5.24.2",
"aws-sdk": "^2.743.0",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"cuid": "^2.1.8",
"dotenv-flow": "^3.2.0",
"faker": "^5.1.0",
"graphql": "14.6.0",
"graphql-iso-date": "^3.6.1",
"graphql-middleware": "4.0.1",
"graphql-shield": "7.3.6",
"graphql-yoga": "1.18.3",
"jsonwebtoken": "8.5.1",
"lodash": "^4.17.20",
"multer": "^1.4.2",
"nexus-plugin-prisma": "0.19.0",
"sanitize-html": "^2.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^1.17.8",
"@graphql-codegen/typescript": "^1.17.9",
"@graphql-codegen/typescript-operations": "^1.17.8",
"@graphql-codegen/typescript-react-apollo": "^2.0.6",
"@prisma/cli": "2.7.0",
"@types/aws-sdk": "^2.7.0",
"@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.7",
"@types/cuid": "^1.3.1",
"@types/dotenv-flow": "^3.1.0",
"@types/faker": "^4.1.12",
"@types/graphql-iso-date": "^3.4.0",
"@types/jsonwebtoken": "8.5.0",
"@types/multer": "^1.4.4",
"@types/node": "12.12.54",
"@types/sanitize-html": "^1.27.0",
"@types/ws": "^7.2.7",
"ts-node": "9.0.0",
"ts-node-dev": "1.0.0-pre.50",
"typescript": "4.0.3"
}
}
The error I get
Prisma 2.7.0
Error: No schema defined
at GraphQLServer.createHttpServer (/home/zaneh/Desktop/redacted/node_modules/graphql-yoga/src/index.ts:352:13)
at GraphQLServer.start (/home/zaneh/Desktop/redacted/node_modules/graphql-yoga/src/index.ts:387:25)
at Object.<anonymous> (/home/zaneh/Desktop/redacted/packages/backend/src/server.ts:46:8)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Module.m._compile (/home/zaneh/Desktop/redacted/node_modules/ts-node/src/index.ts:1043:23)
at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/zaneh/Desktop/redacted/node_modules/ts-node/src/index.ts:1046:12)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Prisma 2.8.0
yarn run v1.22.5
warning package.json: No license field
$ npm -s run generate:prisma && npm -s run generate:nexus
Environment variables loaded from prisma/.env
Error:
TypeError: Cannot read property '0' of undefined
at DMMFClass.resolveInputTypes (/home/zaneh/Desktop/redacted/node_modules/@prisma/client/generator-build/index.js:9953:39)
at new DMMFClass (/home/zaneh/Desktop/redacted/node_modules/@prisma/client/generator-build/index.js:9932:10)
at new TSClient (/home/zaneh/Desktop/redacted/node_modules/@prisma/client/generator-build/index.js:10331:17)
at buildClient (/home/zaneh/Desktop/redacted/node_modules/@prisma/client/generator-build/index.js:11421:18)
at generateClient (/home/zaneh/Desktop/redacted/node_modules/@prisma/client/generator-build/index.js:11476:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
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",
For me, @nexus/schema version 0.15.0 fixed it on linux!
Relevant dependencies:
@prisma/client": "2.7.0",
"@prisma/cli": "2.7.0",
"@nexus/schema": "0.15.0",
"nexus-plugin-prisma": "0.20.0",
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",
😓 I'm still seeing getTypeMap of undefined
@ZaneH make sure to remove ^ from your version, e.g. "@nexus/schema": "0.16.0".
package.json
{
"name": "@redacted/backend",
"version": "1.0.0",
"scripts": {
"generate": "npm -s run generate:prisma && npm -s run generate:nexus",
"generate:prisma": "prisma generate",
"generate:nexus": "ts-node --transpile-only src/schema",
"dev": "ts-node-dev --no-notify --respawn --transpileOnly src/server",
"codegen": "graphql-codegen --config codegen.yml",
"seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@nexus/schema": "0.16.0",
"@paypal/checkout-server-sdk": "^1.0.2",
"@prisma/client": "2.7.0",
"@sendgrid/mail": "^7.2.6",
"@sentry/node": "^5.24.2",
"@sentry/tracing": "^5.24.2",
"aws-sdk": "^2.743.0",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"cuid": "^2.1.8",
"dotenv-flow": "^3.2.0",
"faker": "^5.1.0",
"graphql": "^15.3.0",
"graphql-iso-date": "^3.6.1",
"graphql-middleware": "4.0.1",
"graphql-shield": "7.3.6",
"graphql-yoga": "1.18.3",
"jsonwebtoken": "8.5.1",
"lodash": "^4.17.20",
"multer": "^1.4.2",
"nexus-plugin-prisma": "^0.20.0",
"sanitize-html": "^2.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^1.17.8",
"@graphql-codegen/typescript": "^1.17.9",
"@graphql-codegen/typescript-operations": "^1.17.8",
"@graphql-codegen/typescript-react-apollo": "^2.0.6",
"@prisma/cli": "2.7.0",
"@types/aws-sdk": "^2.7.0",
"@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.7",
"@types/cuid": "^1.3.1",
"@types/dotenv-flow": "^3.1.0",
"@types/faker": "^4.1.12",
"@types/graphql-iso-date": "^3.4.0",
"@types/jsonwebtoken": "8.5.0",
"@types/multer": "^1.4.4",
"@types/node": "12.12.54",
"@types/sanitize-html": "^1.27.0",
"@types/ws": "^7.2.7",
"ts-node": "9.0.0",
"ts-node-dev": "1.0.0-pre.50",
"typescript": "4.0.3"
}
}
yarn run v1.22.5
warning package.json: No license field
$ npm -s run generate:prisma && npm -s run generate:nexus
Environment variables loaded from prisma/.env
✔ Generated Prisma Client (version: 2.7.0) to ./../../node_modules/@prisma/client in 191ms
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
TypeError: Cannot read property 'getTypeMap' of undefined
at generateMiddlewareFromSchemaAndRuleTree (/home/zaneh/Desktop/redacted/node_modules/graphql-shield/src/generator.ts:241:28)
at MiddlewareGenerator.generator (/home/zaneh/Desktop/redacted/node_modules/graphql-shield/src/generator.ts:293:5)
at MiddlewareGenerator.generate (/home/zaneh/Desktop/redacted/node_modules/graphql-middleware/src/generator.ts:19:17)
at middlewares.map.middleware (/home/zaneh/Desktop/redacted/node_modules/graphql-middleware/src/middleware.ts:72:25)
at Array.map (<anonymous>)
at applyMiddlewareWithOptions (/home/zaneh/Desktop/redacted/node_modules/graphql-middleware/src/middleware.ts:70:45)
at applyMiddleware (/home/zaneh/Desktop/redacted/node_modules/graphql-middleware/src/middleware.ts:129:10)
at new GraphQLServer (/home/zaneh/Desktop/redacted/node_modules/graphql-yoga/src/index.ts:137:13)
at Object.<anonymous> (/home/zaneh/Desktop/redacted/packages/backend/src/server.ts:40:16)
at Module._compile (internal/modules/cjs/loader.js:778:30)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I feel like I've tried every possible combo of known-to-work versions (with clean node_modules)
I just can't seem to get it to work
@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",
@ZaneH
"graphql": "^15.3.0", => "14.7.0" so it is the same as yoga, helped me outGot 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",
No dice, thanks for trying though
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 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.
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
Unfortunately this bug still exists.
Output:
`
ts-node-dev --no-notify --respawn --transpile-only src
[INFO] 15:09:01 ts-node-dev ver. 1.0.0 (using ts-node ver. 9.0.0, typescript ver. 4.0.5)
TypeError: Cannot read property 'some' of undefined
at transformArg (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:91:33)
at Array.map (
at transformInputType (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:219:89)
at /home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:53:46
at Array.map (
at transformSchema (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:53:35)
at transform (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:28:13)
at Object.exports.getTransformedDmmf (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:16:37)
at new SchemaBuilder (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/builder.ts:256:7)
at Object.build (/home/hyperxpizza/programowanie/mip/reporting-system/cc-backend/node_modules/nexus-plugin-prisma/src/builder.ts:175:19)
[ERROR] 15:09:02 TypeError: Cannot read property 'some' of undefined
`
my dependencies:
"dependencies": {
"@nexus/schema": "^0.16.0",
"add": "^2.0.6",
"apollo-server-express": "^2.19.0",
"bcrypt": "^3.0.8",
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-jwt": "^6.0.0",
"graphql": "^14.7.0",
"jsonwebtoken": "^8.5.1",
"nexus-plugin-jwt-auth": "^1.3.1",
"nexus-plugin-prisma": "^0.20.0",
"uuid": "^3.3.2",
"uuidv4": "^6.2.3",
"xlsx": "^0.14.1"
},
"devDependencies": {
"@prisma/cli": "^2.10.2",
"@prisma/client": "^2.11.0",
"@types/bcrypt": "^3.0.0",
"@types/cors": "^2.8.7",
"@types/express": "^4.17.8",
"@types/graphql": "^14.0.5",
"@types/jsonwebtoken": "^8.3.0",
"graphqlgen": "^0.6.0-rc2",
"ts-node": "^8.10.2",
"ts-node-dev": "^1.0.0",
"typescript": "^4.0.5"
}
Most helpful comment
worked for me.