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

About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 15
- Comments: 23 (3 by maintainers)
Commits related to this issue
- Using GraphQL Shield for permissions. Note that there is a bug in the dependency graphql-middleware that requires version 6.0.10 (https://github.com/maticzav/graphql-middleware/issues/433) — committed to paleobot/pbot-api by NoisyFlowers 3 years ago
- Downgrade graphql-middleware due to https://github.com/maticzav/graphql-middleware/issues/433 — committed to wangel13/prisma-next-auth-graphql-starter by wangel13 3 years ago
isMiddlewareGenerator
is incorrectly returning false for graphql-shield permissions, which causes this error to occur in the validation.If you replace
applyMiddleware(schema, permissions)
withapplyMiddleware(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.
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 🙋♂️
downgrading works 😃
To downgrade graphql-middleware package to 6.0.9, do command:
With npm:
npm uninstall graphql-middleware
then donpm install graphql-middleware@6.0.9
With yarn:yarn remove graphql-middleware
then doyarn add graphql-middleware@6.0.9
Same problem here, it worked fine with
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)