-
I am currently in the process of migrating from Apollo Server 2.x over to graphql-yoga, which so far has been surprisingly low effort. However, there's one thing I'm currently trying to wrap my head around: subscription filters. In our current approach we've used the withFilter function from Apollo to let us filter subscriptions, primarily to check for permissions/authorization before publishing an event. To do that, we use an async filter function because our auth check is async. As far as I can tell, the filter function in graphql-yoga does not allow for an async filter function to be provided, so how would I best go about doing this? It's a little hard to supply our exact implementation, but here's a pseudo example of what we're doing in one case:
Seeing how the map function allows for an async function I can do the auth check there and pipe the payload AND the auth result to filter() and then a new map() that only returns the payload, but that seems a bit cumbersome to do. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey there, you are right that the I will create an issue for tracking this. |
Beta Was this translation helpful? Give feedback.
Hey there, you are right that the
filter
utility function currently does not support returning aPromise
. However, nothing speaks against supporting this.I will create an issue for tracking this.