New issue with makeSchema (getTypeMap of undefined)
See original GitHub issueI honestly have no clue where this issue began. Yesterday, at some point, I started getting this error on yarn generate
:
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
Prisma Schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (version: 2.7.0) to ./../../node_modules/@prisma/client in 216ms
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:28: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 can’t think of anything that would’ve caused this, but I tried rolling back to a previous (and known-to-work) commit, deleting my node_modules, and reinstalling, but I never got it back to a working state 🥳. If anyone has any info/debugging tips for this, I’m all ears
My 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",
"aws-sdk": "^2.743.0",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"cuid": "^2.1.8",
"dotenv-flow": "^3.2.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",
"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/graphql-iso-date": "^3.4.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"
}
}
I’ve tried:
- Adding and removing the graphql package in package.json
- console.log(schema) (no output or
undefined
) - Checking the permissions on my project files
- Resetting my DB (and making sure the connection works)
- Commenting out large sections of code
- Using known-to-work package versions from the Prisma examples repo
- Using a different machine
- Removing my middleware altogether
- Following: https://github.com/facebookarchive/relay-starter-kit/issues/58 (no dice)
- Ensuring all of my types are included in the schema
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
New issue with makeSchema (getTypeMap of undefined) #523
I honestly have no clue where this issue began. Yesterday, at some point, I started getting this error on yarn generate: yarn run...
Read more >makeSchema - GraphQL Nexus
makeSchema. Defines the GraphQL schema, by combining the GraphQL types defined by the GraphQL Nexus layer or any manually defined GraphQL named types ......
Read more >Open Source Used In Socio 1.0 - Cisco
This document contains licenses and notices for open source software used in this product. With respect to the free/open source software listed in...
Read more >Apollo makeExecutableSchema throws error "Cannot read ...
javascript - Apollo makeExecutableSchema throws error "Cannot read property 'kind' of undefined" - Stack Overflow. Stack Overflow for Teams – ...
Read more >How to use the nexus.makeSchema function in nexus - Snyk
const schema = makeSchema({ types: schemaTypes, // All inputs are non nullable. // Remember, after release, every new input must be nullable. //...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try not to import
prisma
from thecontext.ts
. Pass it through the args. I had this problem earlier.Old news
I’m making progress, but nothing is making sense yet:
So, I removed
./types/index.ts
and things started working a little bit better. Now I’m only missing 1 type. It’s the Mutation type. However, I think the issue is rooted deeper than “The Mutation file” because in all of my types, the relationalt.model.<other_model>()
fields are error’ing.In addition, I know the code in my type files is correct. It hasn’t been changed since my last working commit.
I’m going to pause here. If anyone can help, I’d appreciate it