UseMiddleware doesn't work as expected with subscriptions #592
Labels
Community 👨👧
Something initiated by a community
Duplicate 🔑
This issue or pull request already exists
Describe the bug
I have a custom checker middleware that I'm using on regular queries with @UseMiddleware(CustomMiddleware), when I try to use that on a subscription, the middleware is not called when the subscription is first queried (which is when authorization checks should happen). The middleware is called when the resolver receives a pubsub message.
However, if I use @Authorized(), the auth checker middleware gets called when you first query the subscription.
To Reproduce
Expected behavior
Middleware should get called when first subscribing to the subscription (onConnect)
Environment (please complete the following information):
Additional context
I've set up a minimal test repo here https://github.com/rigelglen/typegraphql-middleware-subscription-test
You can reproduce using the following
And then
The text was updated successfully, but these errors were encountered: