#How to enable NestJS request lifecycle (guards/interceptors/etc) on GraphQLModule `options.schema`

9 messages · Page 1 of 1 (latest)

next elm
#

I have a GraphQLModule which I'm configuring with the schema property. That all works fine and I can use my subgraph as expected. The one thing I can't seem to figure out is how to get my guards to work with that. Is there any way to hook an APP_GUARD into the resolvers that correspond to the schema property? My guards work for any resolvers that are registered with @Resolver, but all of my guards/pipes/interceptors/etc do not run on anything that comes from schema.

next elm
#

So, with some further exploration I think the issue here is that guards/interceptors/etc are wired up to the resolvers via the resolver-explorer.service. Given that the output from the schema is not ran through that, those resolvers from schema don't get piped through the normal nest request lifecycle. Is there any suggested way to wire up the resolvers from schema to get ran within the nest request lifecycle?

next elm
#

@steady sandal , sorry to toss an @ on here. Any chance you've got some ideas for this, or any individual in particular that may be able to lend a hand here? I think this is something that definitely falls outside of "normal" for the framework, so I'm thinking that I'll need to come up with some bespoke solution for this. That said, I feel like this is a capability that could be beneficial to teams looking to adopt Nest

#

How to enable NestJS request lifecycle (guards/interceptors/etc) on GraphQLModule options.schema

light elk
next elm
next elm
next elm
#

@light elk , I gave this a shot but it unfortunately didn't seem to help. This seems to leave apollo plugins, or vanilla express middleware as options. Any other ideas than those?