-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic resolver as a middleware? #2565
Comments
I added some code on the related issue you mentioned to get to the dynamic schema. It may help |
@sbrichardson thanks for the reply. Your sample code shows the possibility of a dynamic schema In theory we could make this work by starting an internal introspection server, generating a But this adds a huge overhead of boot time as a lambda function, quite opposing the reason we go serverless in the first place. |
Breaking every single resolver into their own lambda seems like a pretty bad idea to be honest, because resolvers tend to be rather fine grained and the overhead of calling individual lambdas would be too large. You may want to look into Apollo Federation however, which allows you to break up your schema across services. |
Use Case
Since the example of hosting Apollo Server on AWS Lambda, we are looking at the possibility of breaking every single resolver into their own lambda. Where it would be handy if we can provide a middleware instead of a per-type resolver for the defined schema.
Not sure if this is related to #2560, my use case is somewhat similar to the
context
function signature, with the requested operation as an argument.Could this be a plugin?
TBH this is somehow one level lower than the current exposed options. Instead I think my proposed options should be the core, spinning off the built-in
typeDefs
andresolvers
into an official plugin.Workaround
I don't see a proper workaround except we copy the same function into every single resolver that matches the provided schema.
The text was updated successfully, but these errors were encountered: