graphql-hive / graphql-hive/console
Adding more context to "failed to collect operation" errors
- Dominant language
- TypeScript
- Stars
- 483
- Forks
- 145
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 65
Description
Hey there 👋
This is related to / a follow-up https://github.com/kamilkisiela/graphql-hive/issues/1220
Perhaps I'm missing something but is there any way to enrich [these error log messages](https://github.com/kamilkisiela/graphql-hive/blob/afae33eb214dff16de8f2537b91dae9ddd4f2d76/packages/libraries/client/src/internal/usage.ts#L201) with more context? I know that the `logger` can be supplied at startup but I'm looking to add some dynamic/runtime context related to the currently executing request, _maybe_ similar to how `envelop` offers a [`useErrorHandler`](https://github.com/n1ru4l/envelop/blob/109ae870571f821c20507bcfe9ca2699b4533122/packages/core/docs/use-error-handler.md) configuration
In our personal circumstance we use an apollo koa server, and we keep a `KoaContext` with a `requestId` on it that gets generated by the client - this lets us track requests across our ecosystem of microservices. Ideally, we would love to enrich the error thrown here with our context. This way, any error can be easily associated with the particular HTTP request logs that triggered the error
At the very least, it would be great if the error call included the query document that it was trying to parse.
Contributor guide
Assessment
This issue has not been assessed yet.