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

SubscriptionExceptionResolver.resolveException should accept DataFetchingEnvironment #1087

Open
yassenb opened this issue Nov 14, 2024 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@yassenb
Copy link

yassenb commented Nov 14, 2024

Currently the method in DataFetcherExceptionResolver is Mono<List<GraphQLError>> resolveException(Throwable exception, DataFetchingEnvironment environment) while the method in SubscriptionExceptionResolver is Mono<List<GraphQLError>> resolveException(Throwable exception). It would be nice to have DataFetchingEnvironment passed in as well to include more information in our error logs.

As a side note in DataFetcherExceptionResolver.resolveException I've noticed that for some reason SecurityContextHolder.getContext().getAuthentication() returns an instance of AnonymousAuthentication when I know the user is authenticated (and the same piece of code works correctly elsewhere) and as a work-around I'm force to use environment.getGraphQlContext().get<SecurityContextImpl>(SecurityContext::class.name).getAuthentication() to get the proper authentication instance. Same applies in SubscriptionExceptionResolver

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants