Comments (6)
TLDR: The issue is more general than using the ContentNegotiation
plugin. It has to do with requests that don't have a body.
While running the server with a GET endpoint, and sending a GET request, I see this in the logs:
java.lang.IllegalStateException: No instance for key AttributeKey: Logbook.ResponseProcessingStage
The issue is in a map lookup here (where responseProcessingStageKey = AttributeKey("Logbook.ResponseProcessingStage")
):
The map was supposed to be filled by the proper value here:
The above line is executed when intercepting the Receive Pipeline during the ApplicationReceivePipeline.Before
phase:
As per Ktor docs for ApplicationReceivePipeline:
A pipeline for processing incoming content. When executed, this pipeline starts with an instance of ByteReadChannel.
Using a debugger, I noted that this phase is only executed when the request has some content (body). The unit tests also set up the server with POST endpoints:
@grassehh Based on the above explanation, do you know how to fix the issue?
from logbook.
PS: The receive pipeline can be manually triggered by something like this (here, I added call.receiveText()
to your code):
data class SomeData(val someProp: String)
route("/test") {
get {
call.receiveText()
call.respond(SomeData("someValue"))
}
}
from logbook.
Would like to diagnose and fix this issue if its up for grabs
from logbook.
Would like to diagnose and fix this issue if its up for grabs
@adarshjhaa100 Thanks a lot, true open source spirit!
Any help is appreciated. I did a very preliminary diagnosis in the two comments above yours. For the rest, I'll count on your expertise buddy 💯
from logbook.
PS: The receive pipeline can be manually triggered by something like this (here, I added
call.receiveText()
to your code):data class SomeData(val someProp: String) route("/test") { get { call.receiveText() call.respond(SomeData("someValue")) } }
Thanks for the analysis. Indeed we also did notice this issue for GET routes on our project. The workaround as you mentionned is to manually trigger the pipeline by calling one of the call.receive()
methods.
However I did not mention that in this issue as we thought this is not related.
Unfortunatly, I don't have enough Ktor expertise (and especially about its pipeline mecanism) in order to find the fix yet.
from logbook.
Hello, @ChristianLohmann @msdousti, is there any update about the No instance for key AttributeKey: Logbook.ResponseProcessingStage
issue ?
from logbook.
Related Issues (20)
- Obfuscate json body fields using json path or json pointer HOT 1
- Logbook not read logback configuration from logback-spring.xml HOT 2
- Support native compilation with graalvm HOT 4
- Logs only show header's name but not value if header is added using a Filter in Spring Boot HOT 2
- Micronaut 4 integration based on @ClientFilter & @ServerFilter
- UnsupportedOperationException in LogbookHttpRequestInterceptor with Spring Boot 3.2.0 and Apache Http Client 5 HOT 6
- No traceId for SpringCloudGateway request in SpringBoot 3.2.0 HOT 3
- Make Logbook interceptors fault tolerant HOT 3
- Do not mention issues with "not-a-bug" label in release notes HOT 4
- Logbook 3.7.0 pulls in Lombok as transitive dependency HOT 9
- Spring Boot 3 + Micrometer Tracing: Context empty in Server request/response logs HOT 6
- Logbook 3.7.1 pulls in a whole bunch of test dependencies to the production classpath HOT 5
- Eliminate superfluous filter execution HOT 1
- Does setting the log level to debug enable log output? HOT 1
- UnsupportedOperationException: null when using logbook-httpclient (4.0) HOT 1
- mark/reset not supported after adding LogbookClientHttpRequestInterceptor with TRACE logging level HOT 1
- Allow automatic context propagation when using Spring Webflux
- Possible OOM with large servlet response HOT 6
- RESTEASY003765: Response is closed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logbook.