-
Notifications
You must be signed in to change notification settings - Fork 44
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
ServerRequestContext.currentRequest() is empty when enable-automatic-context-propagation: true #495
Labels
type: bug
Something isn't working
Comments
@vad3x Thanks for reporting. Just want to clarify, did you also have
specified in your original non-working version? |
Hi @jeremyg484, yes, I have UPD: updated |
jeremyg484
added a commit
that referenced
this issue
Mar 5, 2024
DefaultGraphQLInvocation and DefaultGraphQLExecutionInputCustomizer are updated to use Mono and Flux in their internal implementation in order to ensure that the Micronaut PropagationContext is carried appropriately through the invocation flow. Previous use of the bare io.micronaut.core.async.publisher.Publishers API in DefaultGraphQLExecutionInputCustomizer was causing the context not to be propagated as desired when including the Micrometer Context Propagation library. A test is added to verify the context propagation works as expected. Some additional cleanup is done throughout the test suite to reduce the scope of included Micronaut beans to the specific tests in order to make it easier to test different setups. Resolves #495
sdelamo
pushed a commit
that referenced
this issue
Mar 7, 2024
DefaultGraphQLInvocation and DefaultGraphQLExecutionInputCustomizer are updated to use Mono and Flux in their internal implementation in order to ensure that the Micronaut PropagationContext is carried appropriately through the invocation flow. Previous use of the bare io.micronaut.core.async.publisher.Publishers API in DefaultGraphQLExecutionInputCustomizer was causing the context not to be propagated as desired when including the Micrometer Context Propagation library. A test is added to verify the context propagation works as expected. Some additional cleanup is done throughout the test suite to reduce the scope of included Micronaut beans to the specific tests in order to make it easier to test different setups. * Avoid direct instantiation of DefaultApplicationContext Resolves #495
sdelamo
pushed a commit
that referenced
this issue
Mar 7, 2024
DefaultGraphQLInvocation and DefaultGraphQLExecutionInputCustomizer are updated to use Mono and Flux in their internal implementation in order to ensure that the Micronaut PropagationContext is carried appropriately through the invocation flow. Previous use of the bare io.micronaut.core.async.publisher.Publishers API in DefaultGraphQLExecutionInputCustomizer was causing the context not to be propagated as desired when including the Micrometer Context Propagation library. A test is added to verify the context propagation works as expected. Some additional cleanup is done throughout the test suite to reduce the scope of included Micronaut beans to the specific tests in order to make it easier to test different setups. * Avoid direct instantiation of DefaultApplicationContext Resolves #495
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
ServerRequestContext.currentRequest()
should not be empty.Actual Behaviour
ServerRequestContext.currentRequest() is empty when
enable-automatic-context-propagation: true
which breaks main services such asSecurityService
.Steps To Reproduce
implementation("io.micronaut.reactor:micronaut-reactor")
to gradle.implementation("io.micrometer:context-propagation")
.ServerRequestContext.currentRequest()
is empty forDataFetcher
s.Data fetcher example:
Setting
enable-automatic-context-propagation: false
makesServerRequestContext.currentRequest()
to be not empty.The workaround I found is to avoid using
io.micronaut.core.async.publisher.Publishers.*
library.For example, If I override DefaultGraphQLInvocation.invoke with:
And DefaultGraphQLExecutionInputCustomizer.customize
it now starts working well (
ServerRequestContext.currentRequest()
is NOT empty forDataFetcher
s).Environment Information
Example Application
No response
Version
5.2.3
The text was updated successfully, but these errors were encountered: