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

"Unsupported Confluence API call" when using versions >2.6.0 #1094

Open
hasier opened this issue Feb 20, 2025 · 9 comments
Open

"Unsupported Confluence API call" when using versions >2.6.0 #1094

hasier opened this issue Feb 20, 2025 · 9 comments
Labels
confluence-issue An issue that related to a Confluence-related bug. investigation Developers are trying to look at this for more information or to reproduce

Comments

@hasier
Copy link

hasier commented Feb 20, 2025

This issue is essentially the same as #991, except bumping to version 2.6.0+ did not fix the issue for us (I also wrote a comment there, but figured it might be best to open a new issue).

We have experienced everything massdosage went through exactly as mentioned in the original issue, except for the fact that it is not resolved for us 😅 We are currently pinned at 2.4.0, which is fine for now, but it'd be good to be able to move to more recent versions. Please see below the debugging logs as requested previously in the original issue.

We have not tried using v1 as I saw in the original issue it is discouraged.

Request to fetch property
GET https://YOUR_SITE.atlassian.net/wiki/api/v2/pages/YOUR_PAGE_ID/properties?key=content-appearance-published

{
  "results": [
      {
        "version": {
        "number": 1,
        "message": "",
        "minorEdit": false,
        "authorId": "",
        "createdAt": "2022-07-26T06:46:57.433Z"
      },
      "value": "full-width",
      "key": "content-appearance-published",
      "id": REDACTED
    }
  ],
  "_links": {
    "base": "https://REDACTED.atlassian.net/wiki"
  }
}
Report

Running in a ubuntu-latest Github Action.

(system)
 platform: Linux-6.8.0-1017-azure-x86_64-with-glibc2.39
   python: 3.11.11 (main, Dec 4 2024, 12:58:35) [GCC 13.2.0]
   sphinx: 8.1.3
 docutils: 0.21.2
 requests: 2.32.3
  urllib3: 2.3.0
  builder: 2.9.0
(configuration)
confluence_ask_password: False
confluence_page_generation_notice: True
confluence_page_hierarchy: True
confluence_parent_page: (set)
confluence_publish: True
confluence_publish_debug: headers_and_data
confluence_server_pass: (set)
confluence_server_url: https://(removed) (cloud)
confluence_server_user: (set)
confluence_space_key: (set; upper)
(confluence instance)
 connected: yes
   fetched: yes
   decoded: yes
    parsed: yes
      type: confluence
   version: 1000.0.0-43d301f101ec
     build: 6452
Last 2 requests

Using confluence_publish_debug = "headers_and_data"

(debug) Request: get_page_property]
GET https://REDACTED.atlassian.net/wiki/api/v2/pages/REDACTED/properties?key=content-appearance-published
User-Agent: SphinxConfluenceBuilder/2.9.0
Accept-Encoding: gzip, deflate, br
Accept: application/json; charset=utf-8
Connection: keep-alive
X-Atlassian-Token: no-check
Authorization: (redacted)
(debug) Response]
Code: 200
Date: Wed, 22 Jan 2025 10:08:49 GMT
Content-Type: application/json;charset=utf-8
Server: AtlassianEdge
Vary: Accept-Encoding
X-Confluence-Request-Time: 1737540528932
Link: <https://REDACTED.atlassian.net/wiki>; rel="base"
Content-Language: en-US
Content-Encoding: gzip
Atl-Confluence-Via: REDACTED
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Atl-Traceid: REDACTED
Atl-Request-Id: REDACTED
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Report-To: {"endpoints": [{"url": "https://REDACTED.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Server-Timing: atl-edge;dur=167,atl-edge-internal;dur=14,atl-edge-upstream;dur=154,atl-edge-pop;desc="aws-us-east-1"
Transfer-Encoding: chunked
(debug) Response data]
{
 "results": [
   {
     "version": {
       "number": 1,
       "message": "",
       "minorEdit": false,
       "authorId": "",
       "createdAt": "2022-07-26T06:46:57.433Z"
     },
     "value": "full-width",
     "key": "content-appearance-published",
     "id": "REDACTED"
   }
 ],
 "_links": {
   "base": "https://REDACTED.atlassian.net/wiki"
 }
}
(debug) Request: store_page_property]
PUT https://REDACTED.atlassian.net/wiki/api/v2/pages/REDACTED/properties/REDACTED
User-Agent: SphinxConfluenceBuilder/2.9.0
Accept-Encoding: gzip, deflate, br
Accept: application/json; charset=utf-8
Connection: keep-alive
X-Atlassian-Token: no-check
Content-Length: 177
Content-Type: application/json
Authorization: (redacted)
(debug) Request data]
(non-json)
(debug) Response]
Code: 400
Date: Wed, 22 Jan 2025 10:08:49 GMT
Content-Type: application/json;charset=utf-8
Server: AtlassianEdge
X-Confluence-Request-Time: 1737540529119
Content-Language: en-US
Atl-Confluence-Via: REDACTED
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Atl-Traceid: REDACTED
Atl-Request-Id: REDACTED
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Report-To: {"endpoints": [{"url": "https://REDACTED.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Content-Encoding: br
Vary: Accept-Encoding
Server-Timing: atl-edge;dur=176,atl-edge-internal;dur=13,atl-edge-upstream;dur=163,atl-edge-pop;desc="aws-us-east-1"
Transfer-Encoding: chunked
(debug) Response data]
{
 "errors": [
   {
     "status": 400,
     "code": "BAD_REQUEST",
     "title": "Cannot update content property. Property : JsonContentProperty{id='JsonContentPropertyId{id=REDACTED}', key='content-appearance-published', content=ExpandedReference{idProperties={version=CollapsedReference{idProperties={number=297}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current, id=ContentId{id=REDACTED}}, of=some(Content{id='ContentId{id=REDACTED}', type=page, title='Dictionary Objects', status=current, space=CollapsedReference{idProperties={key=CON}, referentClass=class com.atlassian.confluence.api.model.content.Space}, history=CollapsedReference{idProperties={contentParent=CollapsedReference{idProperties={version=CollapsedReference{idProperties={number=297}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current, id=ContentId{id=REDACTED}}, referentClass=class com.atlassian.confluence.api.model.content.Content}}, referentClass=class com.atlassian.confluence.api.model.content.History}, version=CollapsedReference{
     "detail": null
   }
 ]
}
sphinxcontrib.confluencebuilder error:
---
Unsupported Confluence API call
An unsupported Confluence API call has been made. See the following
details for more information:
REQ: PUT
RSP: 400
URL: https://REDACTED.atlassian.net/wiki/
API: api/v2/pages/REDACTED/properties
DATA: {
 "errors": [
   {
     "status": 400,
     "code": "BAD_REQUEST",
     "title": "Cannot update content property. Property : JsonContentProperty{id='JsonContentPropertyId{id=REDACTED}', key='content-appearance-published', content=ExpandedReference{idProperties={version=CollapsedReference{idProperties={number=297}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current, id=ContentId{id=REDACTED}}, of=some(Content{id='ContentId{id=REDACTED}', type=page, title='Dictionary Objects', status=current, space=CollapsedReference{idProperties={key=CON}, referentClass=class com.atlassian.confluence.api.model.content.Space}, history=CollapsedReference{idProperties={contentParent=CollapsedReference{idProperties={version=CollapsedReference{idProperties={number=297}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current, id=ContentId{id=REDACTED}}, referentClass=class com.atlassian.confluence.api.model.content.Content}}, referentClass=class com.atlassian.confluence.api.model.content.History}, version=CollapsedReference{
     "detail": null
   }
 ]
}
@jdknight jdknight added the investigation Developers are trying to look at this for more information or to reproduce label Feb 21, 2025
@jdknight
Copy link
Member

Thanks for the detailed report; it is appreciated. Also, sorry for missing the initial request for help.

The logs provided did help with one thing so far. Logging with:

confluence_publish_debug = 'headers-and-data'

Was not properly logging request JSON data to the standard output stream. I've added a change to address this (#1095). If you are willing, mind trying with a development installation with logging enabled:

pip install git+https://github.com/sphinx-contrib/confluencebuilder.git

Hopefully this will reveal the specific contents of that last store_page_property request which is causing the 400 error.

@hasier
Copy link
Author

hasier commented Feb 24, 2025

No worries @jdknight! Thanks for looking into it.

I just re-run using the current main head (6525c1bd88f0df5aac656f8bca725b273e2de9bf), please find the logs below:

Last 2 requests
(debug) Request: get_page_property]
GET https://REDACTED.atlassian.net/wiki/api/v2/pages/REDACTED/properties?key=content-appearance-published
User-Agent: SphinxConfluenceBuilder/2.12.0.dev0
Accept-Encoding: gzip, deflate, br
Accept: application/json; charset=utf-8
Connection: keep-alive
X-Atlassian-Token: no-check
Authorization: (redacted)
(debug) Response]
Code: 200
Date: Mon, 24 Feb 2025 11:54:30 GMT
Content-Type: application/json;charset=utf-8
Server: AtlassianEdge
Vary: Accept-Encoding
X-Confluence-Request-Time: 1740398070321
Link: <https://REDACTED.atlassian.net/wiki>; rel="base"
Content-Language: en-US
Content-Encoding: gzip
Atl-Confluence-Via: h:confluence-prod-eu-3-2.prod.atl-paas.net
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Atl-Traceid: REDACTED
Atl-Request-Id: REDACTED
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Report-To: {"endpoints": [{"url": "https://REDACTED.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Server-Timing: atl-edge;dur=125,atl-edge-internal;dur=13,atl-edge-upstream;dur=112,atl-edge-pop;desc="aws-us-east-1"
Transfer-Encoding: chunked
(debug) Response data]
{
 "results": [
   {
     "version": {
       "number": 1,
       "message": "",
       "minorEdit": false,
       "authorId": "",
       "createdAt": "2022-07-26T06:46:57.433Z"
     },
     "value": "full-width",
     "key": "content-appearance-published",
     "id": "REDACTED"
   }
 ],
 "_links": {
   "base": "https://REDACTED.atlassian.net/wiki"
 }
}
(debug) Request: store_page_property]
PUT https://REDACTED.atlassian.net/wiki/api/v2/pages/REDACTED/properties/REDACTED
User-Agent: SphinxConfluenceBuilder/2.12.0.dev0
Accept-Encoding: gzip, deflate, br
Accept: application/json; charset=utf-8
Connection: keep-alive
X-Atlassian-Token: no-check
Content-Length: 177
Content-Type: application/json
Authorization: (redacted)
(debug) Request data]
{
 "version": {
   "number": 2,
   "message": "",
   "minorEdit": false,
   "authorId": "",
   "createdAt": "2022-07-26T06:46:57.433Z"
 },
 "value": "default",
 "key": "content-appearance-published"
}
(debug) Response]
Code: 400
Date: Mon, 24 Feb 2025 11:54:30 GMT
Content-Type: application/json;charset=utf-8
Server: AtlassianEdge
X-Confluence-Request-Time: 1740398070461
Content-Language: en-US
Atl-Confluence-Via: h:confluence-prod-eu-3-2.prod.atl-paas.net
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Atl-Traceid: REDACTED
Atl-Request-Id: REDACTED
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Report-To: {"endpoints": [{"url": "https://REDACTED.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Content-Encoding: br
Vary: Accept-Encoding
Server-Timing: atl-edge;dur=176,atl-edge-internal;dur=17,atl-edge-upstream;dur=160,atl-edge-pop;desc="aws-us-east-1"
Transfer-Encoding: chunked
(debug) Response data]
{
 "errors": [
   {
     "status": 400,
     "code": "BAD_REQUEST",
     "title": "Cannot update content property. Property : JsonContentProperty{id='JsonContentPropertyId{id=REDACTED}', key='content-appearance-published', content=ExpandedReference{idProperties={id=ContentId{id=REDACTED}, version=CollapsedReference{idProperties={number=307}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current}, of=some(Content{id='ContentId{id=REDACTED}', type=page, title='Dictionary Objects', status=current, space=CollapsedReference{idProperties={key=CON}, referentClass=class com.atlassian.confluence.api.model.content.Space}, history=CollapsedReference{idProperties={contentParent=CollapsedReference{idProperties={id=ContentId{id=REDACTED}, version=CollapsedReference{idProperties={number=307}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current}, referentClass=class com.atlassian.confluence.api.model.content.Content}}, referentClass=class com.atlassian.confluence.api.model.content.History}, version=CollapsedReference{
     "detail": null
   }
 ]
}
sphinxcontrib.confluencebuilder error:
---
Unsupported Confluence API call
An unsupported Confluence API call has been made. See the following
details for more information:
REQ: PUT
RSP: 400
URL: https://REDACTED.atlassian.net/wiki/
API: api/v2/pages/REDACTED/properties
DATA: {
 "errors": [
   {
     "status": 400,
     "code": "BAD_REQUEST",
     "title": "Cannot update content property. Property : JsonContentProperty{id='JsonContentPropertyId{id=REDACTED}', key='content-appearance-published', content=ExpandedReference{idProperties={id=ContentId{id=REDACTED}, version=CollapsedReference{idProperties={number=307}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current}, of=some(Content{id='ContentId{id=REDACTED}', type=page, title='Dictionary Objects', status=current, space=CollapsedReference{idProperties={key=CON}, referentClass=class com.atlassian.confluence.api.model.content.Space}, history=CollapsedReference{idProperties={contentParent=CollapsedReference{idProperties={id=ContentId{id=REDACTED}, version=CollapsedReference{idProperties={number=307}, referentClass=class com.atlassian.confluence.api.model.content.Version}, status=current}, referentClass=class com.atlassian.confluence.api.model.content.Content}}, referentClass=class com.atlassian.confluence.api.model.content.History}, version=CollapsedReference{
     "detail": null
   }
 ]
}

@jdknight
Copy link
Member

Thanks for the logs.

Looking at the output, I do not see anything obvious that would indicate that the store_page_property request made is invalid. Interesting that the title entry on the error seems to be cut off, so we might not be seeing the explicit reason why Confluence believes it is a bad request.

Browsing online, this appears to be related to CONFCLOUD-72142. I cannot guarantee that this is the error maps to the jsonproperty.duplicate.key error others have reported. CONFCLOUD-71704 is another issue that could be related. I wonder if we can get an entire property dump of the specific page publishing is failing on. Specifically, this means opening a browser and venturing to:

https://YOURSITE.atlassian.net/wiki/api/v2/pages/YOURID/properties
 (or)
https://YOURSITE.atlassian.net/wiki/rest/api/content/YOURID/property

Replacing YOURSITE and YOURID and seeing what properties are assigned on a page. I wonder if there are multiple entries with the same key content-appearance-published. If so, we could possibly tweak this extension to detect this and remove any duplicate entries.

@hasier
Copy link
Author

hasier commented Feb 25, 2025

Interesting. I have checked both URLs for the property and it might be related to this duplication issue you mention, but it only seems to be visible in v1.

https://YOURSITE.atlassian.net/wiki/api/v2/pages/YOURID/properties (single value)
{
  "version": {
    "number": 1,
    "message": "",
    "minorEdit": false,
    "authorId": "",
    "createdAt": "2022-07-26T06:46:57.433Z"
  },
  "value": "full-width",
  "key": "content-appearance-published",
  "id": "REDACTED_1"
}
https://YOURSITE.atlassian.net/wiki/rest/api/content/YOURID/property (duplicated values)
{
  "id": "REDACTED_1",
  "key": "content-appearance-published",
  "value": "full-width",
  "version": {
    "when": "2022-07-26T06:46:57.433Z",
    "message": "",
    "number": 1,
    "minorEdit": false,
    "contentTypeModified": false
  },
  "_expandable": {
    "content": "/rest/api/content/YOURID"
  },
  "_links": {
    "self": "https://YOURSITE.atlassian.net/wiki/rest/api/content/YOURID/property/content-appearance-published"
  }
},
{
  "id": "REDACTED_2",
  "key": "content-appearance-published",
  "value": "default",
  "version": {
    "when": "2025-02-24T16:32:49.556Z",
    "message": "",
    "number": 212,
    "minorEdit": false,
    "contentTypeModified": false
  },
  "_expandable": {
    "content": "/rest/api/content/YOURID"
  },
  "_links": {
    "self": "https://YOURSITE.atlassian.net/wiki/rest/api/content/YOURID/property/content-appearance-published"
  }
}

REDACTED_1 is present in both responses, but REDACTED_2 is only visible in v1. However, what's worse... Opening https://YOURSITE.atlassian.net/wiki/rest/api/content/YOURID/property/content-appearance-published, which is the same original URL for v1 but specific to content-appearance-published, shows a single block for REDACTED_2 😵 So we have v1 showing both values, but mainly pointing to REDACTED_2, and v2 showing only REDACTED_1.

I am guessing this behaviour is just an ordering issue, so they are just showing the lowest value id in v1 and highest in v2 or something like that, and not some sort of default value mismatch between v1 and v2?

I also tested https://YOURSITE.atlassian.net/wiki/api/v2/pages/YOURID/properties/PROPID and both REDACTED_1 and REDACTED_2 yield actual results which look similar to their v1 counterparts.

https://YOURSITE.atlassian.net/wiki/api/v2/pages/YOURID/properties/REDACTED_1
{
  "version": {
    "number": 1,
    "message": "",
    "minorEdit": false,
    "authorId": "",
    "createdAt": "2022-07-26T06:46:57.433Z"
  },
  "value": "full-width",
  "key": "content-appearance-published",
  "id": "REDACTED_1"
}
https://YOURSITE.atlassian.net/wiki/api/v2/pages/YOURID/properties/REDACTED_2
{
  "version": {
    "number": 212,
    "message": "",
    "minorEdit": false,
    "authorId": "61a73a22fe9f300068ab8347",
    "createdAt": "2025-02-24T16:32:49.556Z"
  },
  "value": "default",
  "key": "content-appearance-published",
  "id": "258277392"
}

Not sure there is an easy way forward to test this? I was thinking maybe deleting one of the ids, but not sure there's a safe(r) value to get rid of?

@jdknight
Copy link
Member

Great find, especially the discrepancies between what the v1 API states and the v2 API! Thanks for testing it out. Without trying to speculate on how the situation occurred, I would imagine this is an undesired persistence state in Confluence.

What to do next will vary on how you want to approach this. If in a state that's blocking what you want to do, I would imagine you could either just delete the page and have a new one re-create it during a publish event (in hopes the property will be cleared). If history is desired, you should be able to use the API in a way to remove the property entries. I would assume removing one or all of these properties should be fine and Confluence can recover itself -- at worst, the page may switch from a full-width view to a stock view, which you can then re-force the view manually or via a publish event.

However, this only corrects the issue on that specific page. Painful if it's a slew of pages that need finessing. And if it happens again, would require a repeat. And if others experience this, they would also have to do a similar approach. What I could do, if willing to wait/test things (since I do not have an instance myself with this scenario -- although I'll try to trigger the bug on my own space later), I can make a modification to this extension that attempts to cleanup the duplicate property if detected. I can place the logic on a test branch and you could try that to see if it cleans up your space's state -- and in theory, this should not be an issue for anyone using this extension.

@jdknight jdknight added the confluence-issue An issue that related to a Confluence-related bug. label Feb 26, 2025
@hasier
Copy link
Author

hasier commented Feb 26, 2025

That sounds good, I'd be happy to wait. My worry when filing this issue was that it was mentioned in the previous thread that v1 was deprecated and was going to be slowly disappearing, so I wanted to bump to a newer version to ensure the library continued to work. Everything is still working for us in our current version, so I'm ok waiting for a more permanent fix to be included, and of course happy to test it out!

By the way, I am guessing you are going to try to work around reading the info from the v1 URL? As I mentioned before, I thought that v1 is deprecated and was going to disappear, isn't this the case? Just thinking on how the fix might be impacted moving forward.

@PradnyaMhatre
Copy link

Hi team and @jdknight,

My scenario:
While building pages in Sphinx,

  • I make changes to the existing rst file (ex abc.rst)
  • If those new changes are having errors inside it
  • The current build process does not throw any error (used nitpicky = True as well)
  • It builds the project but excludes the page(abc.rst which has errors)
  • It is expected for the build process to throw an error "Unsupported API call" (which comes in "_update_page" function inside file "confluencebuilder/publisher.py")

I found a solution using which we can handle the "Unsupported API call" error while building the code and we won't need to delete the complete page in order to get the error

https://github.com/sphinx-contrib/confluencebuilder/blob/main/sphinxcontrib/confluencebuilder/publisher.py
In above code : Line number 1654 (inside function "_update_page()")

Currently we are only handling error which has term "unreconciled", we are not handling error "Unsupported API call"

Current Code (refer following line):-
if 'unreconciled' in str(ex):
Replacement above Code with (refer following line):-
if any(keyword in str(ex) for keyword in ('unreconciled', 'Unsupported Confluence API call')):

I hope this solution is legit and works for everyone.

Currently I have done the changes in my installed package to handle the scenario for me, however expecting these changes to be made live in the git library as well.

Do let me know if any clarification is required, thanks.

@jdknight
Copy link
Member

@PradnyaMhatre, thanks for the report. I believe the issue you mentioned is a bit different than the issue being discussed here. I believe I should have addressed the issue you mentioned in #1096. Feel free to provide any new comments related to that issue in that pull request.

@jdknight
Copy link
Member

@hasier, I appreciate the willing to wait.

I cannot say I have an exact solution yet. I'm hoping to reproduce your current state by manually issuing some API calls. From there, try to work some sort of means to cleanup (e.g. force clearing the single property on v2 and see if when it's repushed, it will clear itself up). Hoping to avoid v1 calls if possible. If a v1 call is needed, it would mainly be invoked in a background to retry the property update. If the property update fails and then if a v1 call (if needed) fails, it would just be another failure scenario and then looking for an alternative way to address this issue (if it still occurs).

The plan is to take some time this upcoming weekend to investigate and will hopefully have something ready for next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confluence-issue An issue that related to a Confluence-related bug. investigation Developers are trying to look at this for more information or to reproduce
Projects
None yet
Development

No branches or pull requests

3 participants