Skip to content

Bug Report: sphinxcontrib.confluencebuilder - 415 Unsupported Media Type when uploading objects.inv and png files into Confluence Cloud #1179

@PhorstenkampFuzzy

Description

@PhorstenkampFuzzy

Project: sphinx-contrib/confluencebuilder
Version: 3.0.0 (from build log)
Environment:

  • OS: Linux (6.8.0-101-generic-x86_64)
  • Python: 3.13.0 (CPython)
  • Sphinx: 9.1.0
  • Docutils: 0.22.4
  • Jinja2: 3.1.6
  • Pygments: 2.19.2
  • Confluence Instance: Confluence Cloud (api.atlassian.com endpoint detected)

Description:
The sphinxcontrib.confluencebuilder (v3.0.0) fails with a 415 Unsupported Media Type error when attempting to publish generated documentation to a Confluence Cloud instance. The error specifically occurs during the "publishing assets" phase, targeting the objects.inv file, which is an intersphinx inventory.

Observed Behavior:
The build process attempts to upload objects.inv using a POST request to a legacy Confluence Server API endpoint (/rest/api/content/***/child/attachment/***/data) while other operations (e.g., fetching pages) appear to use the modern Confluence Cloud v2 API. The request sends data with Content-Type: multipart/form-data, but the Confluence API responds with HTTP 415, indicating the media type is not supported for that endpoint, and the builder's traceback reports DATA: <not-or-invalid-json>. This suggests a mismatch in the expected data format for attachment uploads on Confluence Cloud when using this specific endpoint.

Steps to Reproduce:

  1. Set up a Sphinx project configured to use sphinxcontrib.confluencebuilder.
  2. Configure conf.py to publish to a Confluence Cloud instance.
    • Ensure confluence_publish_intersphinx is either True (default) or not explicitly set.
  3. Execute the build command: make confluence (or equivalent sphinx-build -b confluence ...).

Expected Behavior:
The objects.inv file should be uploaded successfully to Confluence Cloud, or the builder should handle its publication gracefully without terminating the build process. Ideally, for Confluence Cloud targets, all API interactions, including attachment uploads, should consistently use the appropriate Confluence Cloud v2 API endpoints and their expected data structures.

Technical Details from Log:

#22 10.50 publishing assets... [100%] objects.inv
#22 10.50 (debug) Request: get_attachment]
#22 10.50 GET https://api.atlassian.com/ex/confluence/***/wiki/api/v2/pages/***/attachments?filename=objects.inv
#22 ... (Successful GET request for attachment metadata via v2 API)
#22 10.50 (debug) Request: store_attachment]
#22 10.50 POST https://api.atlassian.com/ex/confluence/***/wiki/rest/api/content/***/child/attachment/***/data
#22 10.50 User-Agent: SphinxConfluenceBuilder/3.0.0
#22 10.50 Accept-Encoding: gzip, deflate
#22 10.50 Accept: application/json; charset=utf-8
#22 10.50 Connection: keep-alive
#22 10.50 X-Atlassian-Token: no-check
#22 10.50 Content-Length: 2259
#22 10.50 Content-Type: multipart/form-data; boundary=********************************
#22 10.50 Authorization: (redacted)
#22 10.50 (debug) Request data]
#22 10.50 (non-json)
#22 10.56 DEBUG:urllib3.connectionpool:https://api.atlassian.com:443 "POST .../wiki/rest/api/content/***/att***/data HTTP/1.1" 415 0
#22 10.56 (debug) Response]
#22 10.56 Code: 415
#22 ... (truncated response headers)
#22 10.58 sphinxcontrib.confluencebuilder error!
#22 ...
#22 10.59     sphinxcontrib.confluencebuilder.exceptions.ConfluenceBadApiError:
#22 10.59     ---
#22 10.59     Unsupported Confluence API call
#22 ...
#22 10.59     REQ: POST
#22 10.59     RSP: 415
#22 10.59     URL: https://api.atlassian.com/ex/confluence/***/wiki/rest/api/content/***/child/attachment/***/data
#22 10.59     API: rest/api/content/***/child/attachment/***/data
#22 10.59     DATA: <not-or-invalid-json>

Workaround:
Disable the publication of the intersphinx inventory file by adding the following to conf.py:

confluence_publish_intersphinx = False

Note: Setting confluence_publish_intersphinx = False has successfully resolved the immediate build failure for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigationDevelopers are trying to look at this for more information or to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions