asciidoctor-kroki: Weird error when URI is too long
I’m using this command on a file that contains a very large PlantUML diagram (File --> 062.adoc.txt)
.\asciidoctor -a diagram-server-url=https://kroki.io/ -a diagram-server-type=kroki_io -a kroki-fetch-diagram -r asciidoctor-kroki "C:\Users\team\Desktop\Large output\Includes\062.adoc"
I’m suspecting that the URI is too large but I get the following error:
asciidoctor: FAILED: C:/Users/team/Desktop/Large output/Includes/062.adoc: Failed to load AsciiDoc document - undefined method `request_post’ for Net::HTTP:Class
res = ::Net::HTTP.request_post(uri, data) ^^^^^^^^^^^^^
Use --trace to show backtrace
The thing is that I was thinking that using the kroki-fetch-diagram attribute should have prevented this kind of error. What am I doing wrong or what I don’t understand?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (8 by maintainers)
Thanks for your input!
If the file already exists on disk it should not fetch again from Kroki. I believe that’s why it’s faster.
I will keep it open since I think we should add a note in the documentation on how to resolve/workaround the error “414 Uri Too Long”.
Sorry for the delayed reply, I was not able to test anything until now.
You’re right
$ asciidoctor-pdf -a kroki-fetch-diagram -r asciidoctor-kroki doc.adoc
is working fine. I came to use a different command due to the issue with png file generation on windows (#369). Note that I’m not sure it was related, but this is where I ended up.So,
Long story short: everything is working! Thanks for your quick and efficient help 🙇♂️ 👍
I think the issue can be closed.
OH I see, you need to add
kroki-fetch-diagram=true
otherwise it will use aGET
request (since we don’t download/fetch the diagram from Kroki).The following command should be enough:
You can take a look at: https://docs.kroki.io/kroki/setup/configuration/#_max_uri_length and https://github.com/Mogztter/asciidoctor-kroki/tree/ruby-v0.5.0#configuration
Basically, there’s a URI limit so when the size exceed 4000 characters we switch to POST (instead of GET)