graphql-middleware: Type generator exists in middleware but is missing in Schema.

Hi,

since the graphql-middleware update to 6.1.2 I get the following error: MiddlewareError: Type generator exists in middleware but is missing in Schema. I do use graphql-shield v 7.5.0

CleanShot 2021-08-18 at 14 02 27@2x

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 23 (3 by maintainers)

Commits related to this issue

Most upvoted comments

isMiddlewareGenerator is incorrectly returning false for graphql-shield permissions, which causes this error to occur in the validation.

If you replace applyMiddleware(schema, permissions) with applyMiddleware(schema, permissions.generate(schema)) then it will work correctly with the latest version of graphql-middleware, without needing to downgrade.

I’ve been trying different versions of graphql-middleware and am seeing the same as @todda00: the problem starts with 6.1.0.

Same problem, i have a repo to reproduce: https://github.com/wangel13/prisma-next-auth-graphql-starter

error - node_modules/graphql-middleware/dist/validation.mjs (10:0) @ eval
Error: Type generator exists in middleware but is missing in Schema.
null

Confirmed It’s an issue with graphql-shield, since graphql-middleware ships an ESM version of the package and graphql-shield doesn’t, it’s just that graphql-middleware doesn’t like duplicated versions of itself @maticzav

still same problem, 6.0.9 solves it

Me too, same error 🙋‍♂️

However, downgrading to =6.0.9 solves it 👏

downgrading works 😃

To downgrade graphql-middleware package to 6.0.9, do command:

With npm: npm uninstall graphql-middleware then do npm install graphql-middleware@6.0.9 With yarn: yarn remove graphql-middleware then do yarn add graphql-middleware@6.0.9

Same problem here, it worked fine with

  • graphql-middleware 6.1.9
  • graphql-shield 7.5.0
  • next 11.1.2

but after upgrading to next 12 we get the same above error. Downgrading graphql-middleware to 6.0.9 fixed it.

Yeah sorry. I didn’t dig deeper as I have things that I need to finish. If it shows up again I’ll have a look as well.
Thanks for your work! 🤗

I’m running into the same error with anything above 6.0.10 Not using next.js, using webpack / babel (latest versions of both)