confluence-publisher / confluence-publisher

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

Publishing to Confluence failed: Could not read JSON response #123

Open Br0mZ opened 5 years ago

Br0mZ commented 5 years ago

We keep getting the following error when using this plugin to publish to confluence. It's a forked version, modified to our needs. Since @laurentverbruggen knows about our setup ;) and is in here, I hoped he would see this issue :p

Used to work until a few weeks ago. I know they upgraded Confluence to the Crowd release.

[ERROR] Publishing to Confluence failed: Could not read JSON response [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16.272 s [INFO] Finished at: 2019-02-21T10:45:20+01:00 [INFO] Final Memory: 42M/100M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.sahli.asciidoc.confluence.publisher:asciidoc-confluence-publisher-maven-plugin-company:0.5.3:publish (default) on project asciidoc-confluence-publisher: Publishing to Confluence failed: Could not read JSON response: No content to map due to end-of-input [ERROR] at [Source: org.apache.http.impl.io.EmptyInputStream@726ef6aa; line: 1, column: 0] [ERROR] -> [Help 1]

cstettler commented 5 years ago

Hi @Br0mZ, thank you for reporting this issue. Could you please run your Maven build with the debug option (-X) and post the full stacktrace of the exception? Also, which version of Confluence (edition, version number, build number, ...) are you trying to publish to?

Br0mZ commented 5 years ago

Hi @cstettler , Confluence version is 6.10.1.

Stacktrace: stacktrace.txt

Br0mZ commented 5 years ago

@cstettler @alainsahli Is the plugin already compatible with version 6.10.1?

cstettler commented 5 years ago

Hi @Br0mZ, so far, we have not yet been able to test the Confluence Publisher against version 6.10.1. Our automated integration tests are still running against version 6.0.5.

Do you maybe have a minimal AsciiDoc source example available that shows the error described? Is this error occurring for every single page, or only e.g. for pages with attachments?

Br0mZ commented 5 years ago

Hi @cstettler, It happens for every single page, even the most minimalistic one like e.g. this:

= README

== Purpose

This is a testpage.

I'm not the responsible for Confluence in our company and they surely don't want to downgrade to solve our small issue. So I'm stuck at the moment, can't publish any of our documentation. Any ETA on when you'll start testing with the latest version?

cstettler commented 5 years ago

Thank you @Br0mZ for your input and sorry for the delay. I will try to have a look into this issue during the weekend. I understand the priority and agree that it is critical that the Confluence Publisher is working with the latest version of Confluence.

cstettler commented 5 years ago

Hi @Br0mZ, I could finally perform a test using Confluence 6.10.1, but I was unable to reproduce your issue. I am using a docker-based version of Confluence taken from https://hub.docker.com/r/cptactionhank/atlassian-confluence and I published the official Confluence Publisher documentation contained in asciidoc-confluence-publisher-doc/etc/docswithout any problems. The same holds true for your simple test page:

testpage-in-confluence-6 10 1 (please note the Confluence version in the footer)

So, there must be a difference to your setup. Some points to check:

Could you please try to invoke the following curl command from a terminal that has access to your Confluence instance:

curl -v --user <confluence-user>:<password> http://<confluence-url>/rest/api/content/<ancestor-id>/child/page?limit=25&start=0&expand=version

and let me know the output? That is the failing request that was issued according to your log. Thank you!

Br0mZ commented 5 years ago

We are using the server version. My user has sufficient permissions. Url and ancestor are correct ;).

Curl output: {"results":[{"id":"221392671","type":"page","status":"current","title":"README (0.0.1)","extensions":{"position":"none"},"_expandable":{"container":"/rest/api/space/[space]","metadata":"","operations":"","children":"/rest/api/content/221392671/child","restrictions":"/rest/api/content/221392671/restriction/byOperation","history":"/rest/api/content/221392671/history","ancestors":"","body":"","version":"","descendants":"/rest/api/content/221392671/descendant","space":"/rest/api/space/[space]"},"_links":{"self":"https://[servername]/confluence/rest/api/content/221392671","webui":"/pages/viewpage.action?pageId=221392671","edit":"/pages/resumedraft.action?draftId=221392671","tinyui":"/x/Hy8yDQ"}}],"start":0,"limit":25,"size":1,"_links":{"base":"[servername]/confluence","context":"/confluence","self":"[servername]/confluence/rest/api/content/221391177/child/page"}}

[space] and [servername] are off course the replaced values

cstettler commented 5 years ago

Hi @Br0mZ, thank you for your additional input. The output of your curl command looks sintactically correct to me, for sure there is data.

So again looking at your stacktrace, I realize that your are using a fork of the Confluence Publisher (com.[company].y35.pipeline.library:asciidoc-confluence-publisher:pom:0.0.0-SNAPSHOT). Therefore, I can not make any educated guess on the changes you have made on your fork, especially as the relevant stacktrace contains the method calculateAncestorId() which is not part of the Confluence Publisher code.

Would you be able to test your publishing using the latest official version of the Confluence Publisher (0.5.0) and again send a stacktrace? Thank you!

cstettler commented 5 years ago

@Br0mZ do you have any update on this issue?

Br0mZ commented 5 years ago

Hi @cstettler, sorry I didn't get back to you.

That's right, like I said in the first post, we are using a forked version. We already tried the latest version but also encountered problems. Don't remember which ones so let's do that again and I will deliver the stackstrace.

rsakakini commented 5 years ago

Hello @cstettler ,@Br0mZ Seems that the latest version works, i ve been able to publish; not sure it works in every cases. But i had to do a very small modification to the ConfluenceRestClient.

rdmueller commented 5 years ago

can you share your modifications? You mentioned CROWD in the issue description - dies you modification has to do with the authentication?

rsakakini commented 5 years ago

No, it has to do with the CookieSpecs. I m still testing...

rdmueller commented 5 years ago

yes, but afaik does the confluencePublisher not use cookies. but I guess the exception is because of the crows cooky. we have the same problem with docToolchain ..

cstettler commented 5 years ago

The issue with Crowd cookies is tracked in #153. Let's continue the cookie-related discussion there. The issue here reported by @Br0mZ might be unrelated to this (or not), anyway, I am waiting for input based on https://github.com/confluence-publisher/confluence-publisher/issues/123#issuecomment-479871245.

rsakakini commented 5 years ago

Hello, @cstettler, @rdmueller

like @Br0mZ mentioned https://github.com/confluence-publisher/confluence-publisher/issues/123#issuecomment-479871245 , this issue #123 is related to a fork we have. We are now thinking to use the latest version but had some issues #153. We ve made a PR https://github.com/confluence-publisher/confluence-publisher/pull/154 and are waiting for comments / merge.

royteeuwen commented 5 years ago

@Br0mZ any update on having this work ?

Br0mZ commented 5 years ago

Some clarification: I first troubleshot this issue in our company but @rsakakini took over this issue. So to make it clear, we're talking about exactly the same issues here.

@rsakakini has made some improvements and got the latest version to work. I haven't had the time to test it yet, will try to do this asap.