graphql-shield: Types of property 'middlewares' are incompatible.
Bug report
- [Yes] I have checked other issues to make sure this is not a duplicate.
Describe the bug
When using the most current versions of the graphql-yoga and graphl-shield libraries, trying to add shield({ ... }) to the middlewares option of the server creates this error:

(it keeps going for quite a while, just didn’t want to copy and paste five dozen lines)
To Reproduce
Copy and paste the Graphql Yoga example file. No changes are necessary for the error to pop up.
Additional context
graphql-yoga version: 1.16.2
graphql-shield version: 3.2.2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (8 by maintainers)
As you say i updated graphql-yoga and now i’m getting:
my updated package.json
if i install it i get
If i remove graphql-shield from middlewares all is working. Looks like some packages is conflict. But which. Removing ‘graphql-middleware-forward-binding’ from middlewares it is don’t cause any effect
Also then i
yarn installi get some warnings:GOTCHA! Using
graphql": "^0.13.2don’t cause any error. And looks like i don’t need this package, so i remove that and everything work. Don’t know why i installed it, but it is he who conflicts.That totally did the trick, @maticzav 💛 Thanks a bunches!! Can’t wait to try and test it out ✨
Hey @heymartinadams 👋,
No, having rules in a separate folder is completely fine. Peeking at your
package.jsonagain, however, I spotted you have a separate instance ofgraphql-middlewarealongsidegraphql-yoga. Try removing that as well.@kevrat perfect! I think we should add this to the
README.graphql-middlewareandgraphql-yogastill haven’t been updated to the latest GraphQL which might cause the issue that you are describing.I am so glad it’s working now 🎉