-
Notifications
You must be signed in to change notification settings - Fork 572
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
Implement after hook or error handling? #11
Comments
Also it seems if an error occurs in the context function. It crashes the server. Currently my context function is async and checks the token. It would be great if could try to catch an error happening here and return it as a graphql error. |
+1 same issue On the implementation, I think you can better structure the Option type. Also a log level is better than a boolean.
|
I've removed the debug option. I've put these new params in the props will/should it be in the options or should it be in a new field called apollo which will expose all low level apollo server options. export interface Props {
typeDefs?: string
resolvers?: IResolvers
schema?: GraphQLSchema
context?: Context | ContextCallback
options?: Options
formatError?: Function
formatParams?: Function
formatResponse?: Function
logFunction?: LogFunction
} |
Hey, @Urigo from The Guild here! You might know us from projects such as graphql-code-generator, envelop or graphql-tools. For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server. In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀 And regarding the issue here, Yoga uses the Envelop plugin system under the hood which has a very powerful hooks system and a whole ecosystem of plugins, including error handling plugins: https://www.envelop.dev/plugins We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here. Please try Yoga out again, give us feedback and help us spread the word on the new release! |
Right now I generate and start a transaction in the context function and if the graphql request fails due to an error I would like inspect the result if it has any errors and based on that to rollback/commit the transaction. It would be nice if we could have a function similar to context but gets called after the graphql function to clean up connections/log stuff etc.
It seems
apollo-server-express
already exposes this in the optionsIf there could be some way we can pass the apollo server options directly to it using yoga for customizing the apollo server used underneath.
The text was updated successfully, but these errors were encountered: