confluence-publisher / confluence-publisher

Maven plugin and Docker image to convert AsciiDoc and publish it to Confluence
Apache License 2.0
218 stars 87 forks source link

Different errors using the tool #391

Open verhas opened 1 year ago

verhas commented 1 year ago

I have a project https://github.com/verhas/jamal with a lot of adoc files in it. I tried to upload them using the tool to the cloud hosted by Atlassian.

First I ran into the issue that the process fails if a document does not have top-level title. It is okay, but it took me 6 hours debugging to discover that it is not the file it reports, but one that it has link to.

After that I got an error about duplicate key when collecting the attachments to a map, because there are multiple README.adoc files in different directories that the top-level README.adoc links. The key is the name of the file, hence the issue.

I modified the key, may not be a solution, but I wanted to get past this error. Now I get

response: 500 Internal Server Error {"statusCode":500,"data":{"authorized":true,"valid":true,"errors":[],"successful":true},"message":"com.atlassian.confluence.api.service.exceptions.InternalServerException: java.lang.RuntimeException: com.atlassian.confluence.content.render.xhtml.XhtmlException: Unhandled element type '{http://www.w3.org/1999/xhtml}code'"}, reason: <none>)

and I cannot get through it. I debugged the upload and could copy this JSON containing the whole XHTML.

x.json.log

(The other files all have code segments... what is the issue?)

I very much want to use this tool, I successfully uploaded some demos and then I was stuck after two days with the first real-life-sized example.

cstettler commented 1 year ago

Hi @verhas, thank you very much for your valuable report from real-world usage of the Confluence Publisher. Such feedback is much appreciated! We are eating our own dog food for the documentation of the Confluence Publisher to ensure the documented features actually work, and are using it in real-world projects whenever possible / useful. Anyway, every scenario differs from the others and the specific use is hard to foresee.

Since your project is open-source, could you please point me to the corresponding AsciiDoc sources and the Confluence Publisher configuration? That way, I could investigate on the issues reported, file specific bug reports and get them fixed.

Thank you again for your efforts!

verhas commented 1 year ago

The project url is there in the comment.

The configuration is under my fork of confl update in the same github org.

verhas commented 1 year ago

We can also do some interactive session if that helps. I plan to introduce this solution together with Jamal (btw: your project could also use Jamal to avoid errors like the one I fixed in the last PR) at a large Swiss bank on feb 8.

For that, I have to be confident.

zeldigas commented 10 months ago

@verhas would be great if you can provide the command you used to upload docs.

I tried to use text2confl and succeed with uploading docs from "documentation" directory:

<jamal_repo_root>/documention$ text2confl upload --confluence-url https://text2conf.atlassian.net/wiki/  --space JAMAL --docs . --user ... --password ...
WARNING: ENVIRONMENT_VARIABLES.adoc: line 27: section title out of sequence: expected level 1, got level 3
..other warnings about level mismatch...
Created: "README.adoc.jam" from - SAMPLE_README.adoc. URL - https://text2conf.atlassian.net/wiki/x/AQDmAg.
Created: "Jamal API" from - JAMAL_API.adoc. URL - https://text2conf.atlassian.net/wiki/x/AQDoAg.
Created: "Jamal Environment Variables" from - ENVIRONMENT_VARIABLES.adoc. URL - https://text2conf.atlassian.net/wiki/x/CYDmAg.
Created: "Standard Built-In Macro Argument Splitting" from - ARGSPLIT.adoc. URL - https://text2conf.atlassian.net/wiki/x/AoDjAg.
Created: "Modules of the Jamal Project" from - MODULES.adoc. URL - https://text2conf.atlassian.net/wiki/x/FIDnAg.
Created: "Standard Built-In Parop Parsing" from - PAROPS.adoc. URL - https://text2conf.atlassian.net/wiki/x/O4DnAg.
Created: "Debugging" from - HOWTO_DEBUG.adoc. URL - https://text2conf.atlassian.net/wiki/x/BYDmAg.
Created: "Planned and Created Video Tutorials" from - VIDEO.adoc. URL - https://text2conf.atlassian.net/wiki/x/AQDnAg.
Created: "Starting with Jamal in 5 minutes" from - TUTORIAL-5min.adoc. URL - https://text2conf.atlassian.net/wiki/x/AoDmAg.
Created: "Resource Files and Web Resources" from - FILE_NAMES.adoc. URL - https://text2conf.atlassian.net/wiki/x/AYDnAg.

Disclaimer - I'm mostly interested in testing text2confl of course, so you can give it a try as well, and ping me in PM (see profile contacts)

verhas commented 10 months ago

Well, that was more than a year ago.

Does your upload create the confluence pages in their original format? What I tried was to create formatted confluence pages from asciidoc and that did not work, as the conversion failed for some constructs that I used in my documentation files.

zeldigas commented 10 months ago

@verhas I'm not sure what do you mean by "original format"?

verhas commented 10 months ago

The line

Created: "README.adoc.jam" from - SAMPLE_README.adoc. URL - https://text2conf.atlassian.net/wiki/x/AQDmAg

says it uploaded the README.adoc.jam file. This file is asciidoc eith Jamal meta markup. First it has to be processed using Jamal, the. Asciidoc to get the xhtml appropriate fir a confluence page.

Is the uploaded oage a nicely formatted confluence page, or is it text?

zeldigas commented 10 months ago

No, the line says "page with title "README.adoc.jam" was created from source file SAMPLE_README.adoc"

Screenshot_20240105-140009

gjorgiev commented 4 months ago

I am getting the same error while trying to publish asciidoc files to confluence.

response: 500 {"statusCode":500,"message":"","reason":"Internal Server Error"}, reason: <none>)

here is my docker script:

docker run --rm -e ROOT_CONFLUENCE_URL=https://myconfluence.com \ -e SKIP_SSL_VERIFICATION=false \ -e MAX_REQUESTS_PER_SECOND=10 \ -e CONNECTION_TIME_TO_LIVE=500 \ -e PASSWORD= mypassword\ -e SPACE_KEY=myspacekey \ -e ANCESTOR_ID=myancestorid \ -e PAGE_TITLE_PREFIX="Draft - " \ -e PAGE_TITLE_SUFFIX=" (V 1.0)" \ -e PUBLISHING_STRATEGY=REPLACE_ANCESTOR \ -e ORPHAN_REMOVAL_STRATEGY=KEEP_ORPHANS \ -e VERSION_MESSAGE="V 1.0" \ -e NOTIFY_WATCHERS=true \ -e ATTRIBUTES='{"attribute1": "value1", "attribute2": "value2"}' \ -e CONVERT_ONLY=false \ -v /home/georgi/asciidoc-root-folder:/var/asciidoc-root-folder \ confluencepublisher/confluence-publisher:0.0.0-SNAPSHOT

Note: I have all the values starting with my assigned to a valid confluence instance, and the files exist in the corresponding folder.

The funny thing is that the page gets published, but I am getting an error 500 and cannot publish multiple pages (subpages).

Anyone has an idea what it could be the problem?

gjorgiev commented 4 months ago

I am getting the same error while trying to publish asciidoc files to confluence.

response: 500 {"statusCode":500,"message":"","reason":"Internal Server Error"}, reason: <none>)

here is my docker script:

docker run --rm -e ROOT_CONFLUENCE_URL=https://myconfluence.com \ -e SKIP_SSL_VERIFICATION=false \ -e MAX_REQUESTS_PER_SECOND=10 \ -e CONNECTION_TIME_TO_LIVE=500 \ -e PASSWORD= mypassword\ -e SPACE_KEY=myspacekey \ -e ANCESTOR_ID=myancestorid \ -e PAGE_TITLE_PREFIX="Draft - " \ -e PAGE_TITLE_SUFFIX=" (V 1.0)" \ -e PUBLISHING_STRATEGY=REPLACE_ANCESTOR \ -e ORPHAN_REMOVAL_STRATEGY=KEEP_ORPHANS \ -e VERSION_MESSAGE="V 1.0" \ -e NOTIFY_WATCHERS=true \ -e ATTRIBUTES='{"attribute1": "value1", "attribute2": "value2"}' \ -e CONVERT_ONLY=false \ -v /home/georgi/asciidoc-root-folder:/var/asciidoc-root-folder \ confluencepublisher/confluence-publisher:0.0.0-SNAPSHOT

Note: I have all the values starting with my assigned to a valid confluence instance, and the files exist in the corresponding folder.

The funny thing is that the page gets published, but I am getting an error 500 and cannot publish multiple pages (subpages).

Anyone has an idea what it could be the problem?

I found the problem, the files must be named with an extension .asciidoc I had them .adoc and I was getting an error 500.

cstettler commented 4 months ago

Hi @gjorgiev, actually, the Confluence Publisher is only respecting files ending on .adoc, not .asciidoc (see FolderBasedAsciidocPagesStructureProvider). Therefore, I assume that your error only disappeared because no files at all are being processed when using .asciidoc as the file extension. Do you have any additional information available from a log file on the server or the like?

gjorgiev commented 4 months ago

Yes, I agree with you, just checked and actually nothing gets uploaded.

Anyway, if I change back to .adoc I am still getting the same error as before :

Exception in thread "main" org.sahli.asciidoc.confluence.publisher.client.http.RequestFailedException: (request: POST https://wiki.flowable.com/rest/api/content/357238584/property , response: 500 {"statusCode":500,"message":"","reason":"Internal Server Error"}, reason: <none>) at org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient.lambda$sendRequestAndFailIfNot20x$9(ConfluenceRestClient.java:231) at org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient.sendRequest(ConfluenceRestClient.java:246) at org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient.sendRequestAndFailIfNot20x(ConfluenceRestClient.java:228) at org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient.sendRequestAndFailIfNot20x(ConfluenceRestClient.java:224) at org.sahli.asciidoc.confluence.publisher.client.http.ConfluenceRestClient.setPropertyByKey(ConfluenceRestClient.java:315) at org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher.updatePage(ConfluencePublisher.java:197) at org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher.startPublishingReplacingAncestorId(ConfluencePublisher.java:113) at org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher.publish(ConfluencePublisher.java:84) at org.sahli.asciidoc.confluence.publisher.cli.AsciidocConfluencePublisherCommandLineClient.main(AsciidocConfluencePublisherCommandLineClient.java:109)

The weird part is that I asked for the logs from the team responsible for the confluence project, and they told me that there is no 500 error on their side, I am sure we are working on the same instance. Is that possible ?

gjorgiev commented 4 months ago

I am waiting for the logs from the server, so I will come back with more details.

gjorgiev commented 3 months ago

The error disappeared, probably they fixed it on their side and was not an issue with the confluence publisher, Thanks!