Skip to content
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

useOnResolve rewraps field.resolve when other plugins pass the same fields to replaceSchema #1772

Closed
jonapgar-groupby opened this issue May 18, 2023 · 0 comments · Fixed by #1773

Comments

@jonapgar-groupby
Copy link
Contributor

I encountered a perplexing issue where I was seeing doubled resolver spans when using the useOpenTelemetry plugin.

The cause was another plugin useDeferStream which calls the replaceSchema function in order to add some directives to the schema.

https://github.com/dotansimha/graphql-yoga/blob/82f5893446e3c55519194a1ca1d784120cbe7098/packages/plugins/defer-stream/src/index.ts#L37-L42

The issue isn't specific to useOpenTelemetry. Any plugin that calls addPlugin(useOnResolve... could potentially end up rewrapping resolvers.

jonapgar-groupby added a commit to jonapgar-groupby/envelop that referenced this issue May 18, 2023
jonapgar-groupby added a commit to jonapgar-groupby/envelop that referenced this issue May 18, 2023
jonapgar-groupby added a commit to jonapgar-groupby/envelop that referenced this issue May 18, 2023
jonapgar-groupby added a commit to jonapgar-groupby/envelop that referenced this issue May 18, 2023
ardatan pushed a commit that referenced this issue May 22, 2023
* fix: prevent double-wrapping of field.resolve fixes #1772

* fix: useOnResolve double-wrap prevention should be on field not field.resolve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant