asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
355 stars 145 forks source link

PlantUML diagram generation with Kroki is broken again #1657

Closed thetric closed 1 month ago

thetric commented 3 months ago

Observed vs. expected behavior

The preview does not render the diagram:

image

Neither the public Kroki server nor our selfhosted one does work. The IntelliJ logs do not include any errors regarding the generation

Steps to reproduce

Enable Kroki and create the following file:

[plantuml,datafields]
----
object "<datafields>" as s {
}
object "<datafield>" as df

s *-- "0..1" df
----

Environment

Plugin Version: 0.42.2 (0.42.0 too) IntelliJ: 2024.1.4

IntelliJ IDEA 2024.1.4 (Ultimate Edition)
Build #IU-241.18034.62, built on June 20, 2024
Runtime version: 17.0.11+1-b1207.24 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.5
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Registry:
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
Non-Bundled Plugins:
  org.intellij.plugins.hcl (241.17890.8)
  IdeaVIM (2.15.0)
  org.jetbrains.plugins.go-template (241.14494.150)
  com.intellij.properties.bundle.editor (241.14494.150)
  DevKit (241.18034.69)
  com.jetbrains.jax.ws (241.14494.158)
  PlantUML integration (7.10.1-IJ2023.2)
  org.asciidoctor.intellij.asciidoc (0.42.2)
  com.intellij.bigdatatools.core (241.18034.62)
  com.intellij.bigdatatools.binary.files (241.14494.158)
  com.intellij.bigdatatools.rfs (241.18034.62)
  com.jetbrains.packagesearch.intellij-plugin (241.0.11)
  com.dmarcotte.handlebars (241.14494.150)
Kotlin: 241.18034.62-IJ
thetric commented 3 months ago

Related: https://github.com/asciidoctor/asciidoctor-intellij-plugin/issues/1585

ahus1 commented 3 months ago

Sorry this is not working for you. I tried to reproduce it locally, still this is what I see, using the official

image

Can you please provide a larger example where this is failing for you? Do you have an example in a public Git repository? Maybe an AsciiDoc attribute setting is conflicting?

thetric commented 2 months ago

Hm, I guess it is more an issue with our server configuration, Kroki itself or asciidoctor-kroki. When forcing the value of kroki-http-method I observed two different behaviors:

io.vertx.core.json.DecodeException: Failed to decode:Unrecognized token 'object': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 7]
    at io.vertx.core.json.jackson.DatabindCodec.fromParser(DatabindCodec.java:128)
    at io.vertx.core.json.jackson.DatabindCodec.fromString(DatabindCodec.java:89)
    at io.vertx.core.json.JsonObject.fromJson(JsonObject.java:1250)
    at io.vertx.core.json.JsonObject.<init>(JsonObject.java:51)
    at io.kroki.server.service.DiagramRest.lambda$create$0(DiagramRest.java:28)
    at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1285)
    at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:140)
...
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'object': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 7]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2481)
...
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2879)
    at io.vertx.core.json.jackson.DatabindCodec.fromParser(DatabindCodec.java:125)
    ... 56 common frames omitted
thetric commented 2 months ago

This issue can be reproduced using this example: antora-repo.zip

thetric commented 2 months ago

POST is broken in asciidoctor-kroki: https://github.com/asciidoctor/asciidoctor-kroki/issues/448

thetric commented 2 months ago

Insofar not an issue with this plugin but with asciidoctor-kroki? I am not sure how these two relate, so feel free to close this issue

ahus1 commented 2 months ago

Thank you for providing the example. I extracted it and tested it locally. For me it works as expected:

I left it with the defaults which were set to "GET" in your config.

Log shown by Kroki:

{"timestamp":"1725106755239","level":"INFO","thread":"vert.x-eventloop-thread-1","mdc":{"path":"/plantuml/svg/eNrLT8pKTS5RULJJSSxJTMtMzUkptlNSSCxWKFao5qrlyseQhsimpHFxFSto6eoqKBno6RkqAQUAiXgWIQ==","referrer":"asciidoctor/kroki.rb/0.10.0-intellij","method":"GET","service_name":"plantuml","action":"request_received","bytes_read":"0","user_agent":"Ruby"},"logger":"io.kroki.server.service.DiagramHandler","message":"Request received GET /plantuml/svg/eNrLT8pKTS5RULJJSSxJTMtMzUkptlNSSCxWKFao5qrlyseQhsimpHFxFSto6eoqKBno6RkqAQUAiXgWIQ==","context":"default"}
{"timestamp":"1725106755395","level":"INFO","thread":"vert.x-eventloop-thread-1","mdc":{"path":"/plantuml/svg/eNrLT8pKTS5RULJJSSxJTMtMzUkptlNSSCxWKFao5qrlyseQhsimpHFxFSto6eoqKBno6RkqAQUAiXgWIQ==","took":"155","referrer":"asciidoctor/kroki.rb/0.10.0-intellij","method":"GET","service_name":"plantuml","action":"convert","file_format":"svg","user_agent":"Ruby"},"logger":"io.kroki.server.service.DiagramHandler","message":"Convert took 155ms","context":"default"}

Kroki image used

REPOSITORY                TAG         IMAGE ID      CREATED       SIZE
docker.io/yuzutech/kroki  latest      02f27593cc52  5 months ago  1.95 GB

I'm using plugin 0.43.1 on IntelliJ 2024.2.1 RC.

Also tested plugin 0.41.6 and 0.42.2 on IntelliJ 2024.1.6

mgzob commented 2 months ago

I received the same issue where diagrams would not generate . Deleting the /.idea folder in my project and re-loading the folder as a new project solved it. After the .idea folder was regenerated it was sorted. What in the folder was bad, I'm not sure.

Since you're able to create a new example project this might not be your issue, but starting from a fresh project might help although you'll be stuck setting it back up again. Clearly back up your current folder.

System - Win11, WSL docker compose of Kroki 0.25.0 PyCharm 2024.2.1 Plugin version 0.43.1

thetric commented 1 month ago

Aha! My issue came from a misconfigured proxy before Kroki