GraphQL context not correct in Guards when __resolveType handler is called
I'm submitting a...
[ ] Regression
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When in a resolveType handler the context is wrongly resolved. Which makes me unable to use the graphql context in an global guard.
Expected behavior
Context to be resolved correctly
Minimal reproduction of the problem with instructions
https://github.com/JannesV/nestjs-issue-context
What is the motivation / use case for changing the behavior?
Need to use global guards
Environment
Nest version: 6.0.5
For Tooling issues:
- Node version: 8.11.4 \ 10.0
- Platform: Mac\ Linux
I also faced this problem. It's because arguments passed to resolvers by apollo-server are different on field resolvers and __resolveType.
https://www.apollographql.com/docs/graphql-tools/resolvers
But at first place, I can't understand why guard should be applied on __resolveType method. Is there any reason for this?
@kamilmysliwiec
@kamilmysliwiec if you could point me in the right direction I'll gladly submit a PR.
It should be fixed in the @next version ($ npm i @nestjs/graphql@next). You will also have to update @nestjs/core to 6.2.0 ($ npm i @nestjs/[email protected]). Please, let me know if you face any issue.
Published as 6.2.0 ($ npm i @nestjs/graphql@latest). You will also have to update @nestjs/core to 6.2.0 ($ npm i @nestjs/core@latest)
Indeed it works, thank a lot for the work you're doing!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.