Can apolloServer.executeOperation be used in production?

Thank you for your awesome product! We are really enjoying it a lot!

We have a particular production use case that forces us to run some logic after Apollo returns a response, but before the response is sent to the client. My question is can executeOperation be used reliably in production to achieve the is, although it shows only as a testing tool in your docs?
Are there limitations? caveats, pitfalls I need to be aware of?

Thanks in advance!

It won’t necessarily break or anything, but it is designed for testing. Notably, you have to provide the context argument yourself. What kind of logic are you trying to run?

I don’t know if this is exactly what you’re after, but I have a plugin for Apollo Server that hooks on willSendResponse to do some post-resolver operations on the response before it’s sent to the client.

Hi @glasser, thanks for your quick response.

Creating context (I assume you mean integrationContextArgument) is not a problem.

We need to run the logic to fill in parts of the schema implemented by an older (java) graphql implementation, while we gradually migrate to logic to apollo.

Initial experimentation shows executeOperation to be pretty reliable, with a small shortcoming of not being able to easily distinguish between resolver and validation errors.