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

publishToConfluence throws exception when uploading attachments in v3.2.0 #1335

Closed
corradolupo73 opened this issue Jan 10, 2024 · 19 comments · Fixed by #1337
Closed

publishToConfluence throws exception when uploading attachments in v3.2.0 #1335

corradolupo73 opened this issue Jan 10, 2024 · 19 comments · Fixed by #1337

Comments

@corradolupo73
Copy link

Describe the bug
When uploading attachments, e.g., images, using the ConfluenceClient in 3.2.0 via the publicToConfluence task, the following error occurs:


dtcw 0.52 - ##DTCW_GIT_HASH##
docToolchain 3.2.0
OS/arch: pwsh windows x64
Available docToolchain environments: local docker
Environments with docToolchain [3.2.0]: docker
Using environment: docker
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.1.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

Task :core:compileJava NO-SOURCE
Task :core:compileGroovy UP-TO-DATE
Task :core:processResources NO-SOURCE
Task :core:classes UP-TO-DATE
Task :core:jar
Task :generateHTML UP-TO-DATE

Task :publishToConfluence
publish build/html5/index.html
Farm
.
pages retrieved
retrieving page with id 1671036945
found existing page: 1671036945 version 1
page hasn't changed!

  1. Struttura documentazione
    image: /project/build/html5/images/diag-1d6529118cf5d3043239244bb749a8aa.png
    allPages already retrieved
    pages retrieved
    retrieving page with id 1671036946
    found existing page: 1671036946 version 1
    page hasn't changed!
    Uploading attachment to /rest/api/content/1671036946/child/attachment

FAILURE: Build failed with an exception.

  • Where:

Task :publishToConfluence FAILED
Script '/home/dtcuser/docToolchain/scripts/publishToConfluence.gradle' line: 47

  • What went wrong:
    Execution failed for task ':publishToConfluence'.

No such property: ContentType for class: org.docToolchain.atlassian.confluence.clients.ConfluenceClientV1


To Reproduce
Steps to reproduce the behavior:
Install 3.1.0 docToolChain Docker image
docToolchain 3.2.0
OS/arch: pwsh windows x64
Download arc42 template using ./dtcw downloadTemplate
Run ./dtcw publishToConfluence ...
See error

  1. OS/arch: pwsh windows x64
  2. Install 3.2.0 docToolChain Docker image
  3. Referer on section a plantuml diagram:

[plantuml, format=png]
....
include::plantuml/documentazione.puml[]
....

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration

  • docToolchain 3.2.0
  • OS: Windows
  • Atlassian Confluence: Confluence On Premis 6.15.9
@corradolupo73 corradolupo73 changed the title publishToConfluence throws exception when uploading attachments in v3.1.2 publishToConfluence throws exception when uploading attachments in v3.2.0 Jan 10, 2024
@PacoVK
Copy link
Collaborator

PacoVK commented Jan 10, 2024

Thanks for reporting this will be fixed in #1333

@maksymgendin
Copy link

@corradolupo73 In the meantime you could downgrade to version 3.1.2, this worked for me. However there the SVG upload is broken 😄 Waiting for 3.2.1 😊

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 10, 2024

3.2.1 is out just now 😄 @maksymgendin if the SVG upload is broken, do you know the last working version?

@corradolupo73
Copy link
Author

I just tried it, and it's okay!
I have appreciated the fast fixing!!

Very well!

@maksymgendin
Copy link

3.2.1 is out just now 😄 @maksymgendin if the SVG upload is broken, do you know the last working version?

Not sure. WITHOUT SVG upload the version 3.1.2 works for me. The version 3.2.0 (and probably also 3.2.1) is broken due to error reported in #1332, not sure if there the SVG upload is working. Have to check that.

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 11, 2024

After mergin #1337 you could give latest a try, i hope i sorted it out now...

@PacoVK PacoVK reopened this Jan 12, 2024
@maksymgendin
Copy link

maksymgendin commented Jan 12, 2024

After mergin #1337 you could give latest a try, i hope i sorted it out now...

@PacoVK I have bad news, at least for me 😞 Just tried latest and it now fails with this:

2024-01-12T09:28:57.308+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "GET /confluence/rest/api/content/35430059/child/page?type=page&limit=100&start=0 HTTP/1.1[\r][\n]"
2024-01-12T09:28:57.308+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "Accept-Encoding: gzip, x-gzip, deflate[\r][\n]"
2024-01-12T09:28:57.308+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "Authorization: Basic MASKED[\r][\n]"
2024-01-12T09:28:57.309+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "X-Atlassian-Token: no-check[\r][\n]"
2024-01-12T09:28:57.309+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "Host: MASKED:443[\r][\n]"
2024-01-12T09:28:57.309+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "Connection: keep-alive[\r][\n]"
2024-01-12T09:28:57.309+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "User-Agent: Apache-HttpClient/5.3 (Java/17.0.9)[\r][\n]"
2024-01-12T09:28:57.309+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 >> "[\r][\n]"
2024-01-12T09:28:57.334+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 << "HTTP/1.0 404 Not Found[\r][\n]"
2024-01-12T09:28:57.335+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 << "Server: BigIP[\r][\n]"
2024-01-12T09:28:57.335+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 << "Connection: Keep-Alive[\r][\n]"
2024-01-12T09:28:57.336+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 << "Content-Length: 0[\r][\n]"
2024-01-12T09:28:57.336+0100 [DEBUG] [org.apache.hc.client5.http.wire] http-outgoing-0 << "[\r][\n]"

When I open /confluence/rest/api/content/35430059/child/page?type=page&limit=100&start=0 (prefixed with our JIRA server URL) in the browser, I'm getting a proper JSON response 🤔

Could this be caused by our corporate firewall? Will now try to reproduce the same request with cURL...

But I cannot explain why this works in 3.1.2, for example...

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 12, 2024

Hm did you configure a proxy?

@maksymgendin
Copy link

Hm did you configure a proxy?

Nope, we're not using a proxy.

@maksymgendin
Copy link

maksymgendin commented Jan 12, 2024

@PacoVK I've found the issue - it's the Host HTTP header. When I remove the whole header or just the port (443 in my case) from the header value, using cURL - I get a proper JSON response from our Confluence server.

Seems like it's a firewall issue, it doesn't like when there is a port in the Host HTTP header value. But I have no influence on that :(

Is the header required?

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 12, 2024

@maksymgendin awesome really appreciate that you invest your time here!
If it is the port, could you just omit the port? Because if the url is eg https://example.corp then 443 is the default port the connection is sent to

@maksymgendin
Copy link

maksymgendin commented Jan 12, 2024

@PacoVK You're always welcome. Thank YOU (and the community of course) for working on this great tool!

I do not have a port in my Confluence API URL configuration value set...I assume it's the HTTP client which sets the port (and the Host HTTP header) there under the hood.

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 12, 2024

Ah, now i got you! Okay, i will implement a fix that ensures the Host Header will be set without port and then hopefully you are good to go :)

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 12, 2024

And while digging in the Client, do you know if there may be negative implications eg in your corporates firewall if i set a custom User-Agent? I would like to set to something like docToolchain to provide better visibility in the network tracing...

@maksymgendin
Copy link

@PacoVK I think it's generally a great idea, maybe also include the version of used DTC in the user agent header.

Tried different user agents in my environment, all requests were ok.

@PacoVK PacoVK mentioned this issue Jan 12, 2024
3 tasks
@maksymgendin
Copy link

@PacoVK Great work, latest version works in my environment, also with SVG upload! 👏 🎉

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 15, 2024

Nice, thanks for the feedback here. I will close this ticket within the upcoming release :)

@PacoVK
Copy link
Collaborator

PacoVK commented Jan 18, 2024

Close as completed since 3.2.2 is out now :)

@PacoVK PacoVK closed this as completed Jan 18, 2024
@maksymgendin
Copy link

Works like a charme, thanks @PacoVK!

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

Successfully merging a pull request may close this issue.

3 participants