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

Unable to generate diagrams with Kroki using POST method #448

Open
jay-blanc opened this issue Mar 28, 2024 · 3 comments
Open

Unable to generate diagrams with Kroki using POST method #448

jay-blanc opened this issue Mar 28, 2024 · 3 comments

Comments

@jay-blanc
Copy link

jay-blanc commented Mar 28, 2024

Hello,

I'm facing an issue generating diagrams :

  • with Antora and Kroki
  • using the asciidoctor-kroki extension
  • using the POST method (either setting the "kroki-http-method" in the Antora playbook or using huge diagrams (which force the use of the POST method))

The result is the diagram generation is completely stucked.
Indeed, the reading of the HTTP response is never done and the generation of the whole documentation never achieved.

This behaviour never occurred using the GET method (thus it works only with light plantuml diagrams but not huge plantuml diagrams or complex vega diagrams for example).

Looking the source code of the asciidoctor-kroki extension, I saw the use of synchronous XMLHttpRequest (using the xhr.open(method, uri, false) settings) which seems to be deprecated.
I tried using the asynrchonous way but it seems there's a lot of impacts in the source code of the extension.

Did you reproduce it ?
Could you please help me solving this issue ?

PS : the kroki server I run manually is OK as I'm able to generate huge diagrams using POST method through Postman for example. So it really comes from the extension (version 0.17.0).

@ggrossetie
Copy link
Member

I tried using the asynrchonous way but it seems there's a lot of impacts in the source code of the extension.

Asciidoctor.js is synchronous and Asciidoctor extensions are also synchronous so it won't work. If you are using this extension in Antora, you will actually use this implementation https://github.com/ggrossetie/unxhr (synchronous HTTP request in Node.js).

Did you reproduce it ?
Could you please help me solving this issue ?

I can help you but you will need to provide a simple/minimal reproduction case.

@jay-blanc
Copy link
Author

Asciidoctor.js is synchronous and Asciidoctor extensions are also synchronous so it won't work.

I totally agree.

I can help you but you will need to provide a simple/minimal reproduction case.

For sure, here is a full example :

Kroki as a Docker container

version: "3"
services:
  core:
    image: registry.hub.docker.com/yuzutech/kroki
    ports:
      - "8000:8000"

Antora playbook

https://github.com/jay-blanc/antora-playbook.git

asciidoc:
  attributes:
    # Using Kroki as a Docker container
    kroki-server-url: http:https://<SET_HERE_YOUR_KROKI_SERVER>:8000
    # Diagram generation during build process
    kroki-fetch-diagram: true
    # Force POST method requesting Kroki server
    kroki-http-method: post

Result

$ npx antora generate --stacktrace --log-level=all antora-playbook.yml
{ includePaths: [] }

Then it's stucked on { includePaths: [] } on POST call.
Setting it as a GET, the generation can succeed.

@ggrossetie
Copy link
Member

Thanks, I will try to reproduce this issue this week 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants