I have a curious case here. I used
https://start.ktor.io/ to start a new project, I leave everything default and only added two plugins
• Pebble
• kotlinx.serialization
Now if these two blocks here
install(ContentNegotiation) {
json()
}
install(Pebble) {
loader(ClasspathLoader().apply {
prefix = "templates"
})
}
are executed in this order, going to /pebble-index gives me an exception on the backend
kotlinx.serialization.SerializationException: Serializer for class 'PebbleContent' is not found.
As soon as I change the order how those two blocks are called without changing anything else it works as expected.
Is there something I’m missing or not understanding or should a file an issue for this?
To reproduce you just have to download a template with those two plugins and in
Application.kt
switch the order of
configureSerialization()
configureTemplating()
to toggle the error.
It looks like the order of those calls in
Application.kt
depends on the order you added those plugins in the web ui.