Synchrony Heartbeat request fails with 404 HTTP Error due to missing 'synchrony' context path in Confluence Data Center
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Attempting to create a new page in Confluence, with Collaborative Editing enabled, fails with HTTP 404 Error while checking Synchrony heartbeat.
Diagnosis
- Open your Browser's Developer Tools to view the HTTP request sent by the browser
Request for Synchrony heartbeat will fail with HTTP 404 Error as they are sent to the following URL:
https://confluence_fqdn/heartbeat
while the expected URL should be:
https://confluence_fqdn/synchrony/heartbeat
Enabling the DEBUG log for the package
com.atlassian.confluence.plugins.synchrony
and attempting again to create the page will show the following stack trace in theatlassian-confluence.log
:2023-04-06 12:15:38,577 DEBUG [https-jsse-nio2-9443-exec-15] [confluence.plugins.synchrony.SynchronyContextProvider] getContextMap -- url: /pages/createpage.action | traceId: f717e7f287a640ba | userName: tommy | action: createpage java.lang.NullPointerException at com.atlassian.confluence.plugins.synchrony.SynchronyContextProvider.getContextMap(SynchronyContextProvider.java:52) ... ...
If you check the related Confluence access log entry for the above error message, you will be able to find something like:
[04/Apr/2023:12:15:38 +0000] tommy https-jsse-nio2-9443-exec-15 10.30.86.1 GET /pages/createpage.action?useDraft=true&spaceKey=&draftId=385876544&draftShareId=b298ab93-a5fd-4f52-a4d1-dac861808544&& HTTP/1.1 200 161ms 21540 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.42
Pay attention that the entry spaceKey query parameter is not set in the log entry.
Cause
The actual root cause is a draft content entry which has no SPACE ID set.
It is unknown what caused the SPACE ID not to be set.
Solution
- Perform a backup of the database connected to Confluence
- Stop Confluence.
Retrieve a valid SPACE ID with the below SQL statement:
SELECT spaceid FROM "spaces" WHERE spacetype = 'global' AND spacestatus = 'CURRENT' limit 1; /* In case the space key for the Confluence space where the user is attempting to create the page is known use the below query */ SELECT spaceid FROM spaces WHERE spacekey = '<space key of the space where the problem happens'
Execute the below UPDATE statement in the Confluence database:
UPDATE content SET spaceid = <valid space id> WHERE contentid = <content id from draftId in the Confluence access log>
- Start Confluence.
- Ask the user to attempt again to create the page.