Links, Applinks, and macros fail when copying Jira and Confluence to other environments
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
Problem
When moving JIRA and Confluence to a different environment, most of the time in order to test, links between the two instances break. The new environments have different URLs, which affects the issue link in JIRA and page links in Confluence as they rely on application link which has been defined earlier on the older environment. The feature request - JRA-62850Getting issue details... STATUS has been raised to address this issue and update the link automatically.
- Does not apply to the Jira project import solution.
- Does not apply to the Jira and Confluence Cloud solutions.
In Atlassian Cloud URL structure, Confluence Cloud Page ID has some changes compared to the Confluence on-premise server.
Cause
The new environment is using a different baseURL. Links and macros in JIRA and Confluence are dependent on the original baseURL.
When an applink between Jira and Confluence is created, it creates a record in the propertyvalue table using a GUID to define the relationship. If the serverID remains the same, the applinkID will remain the same, and the applink itself may show as working:
SELECT SUBSTR(a.property_key,16,36) as "appId", b.propertyvalue as "Application Name"
FROM propertyentry a join propertystring b on a.id=b.id where a.property_key like 'applinks.admin%name';
The values returned are as follows:
appid, app name
<GUID>,Confluence
The problem with the remote links and macros is that the URL has changed, and the values in the remotelink
table have not been updated to the new URL. You can verify this by running the following query in the Jira or Confluence instance where the links are not working:
SELECT * FROM remotelink WHERE URL is not null;
The returned information will show you that the <JIRA_URL> is still saved with the previous value:
Jira Issue: SCRUM-23 (ID; 10022)
global ID: <GUID>&pageId=1146882 (applink, confluence page id)
title = jira defined variable
url: <JIRA_URL>/confluence/pages/viewpage.action?pageId=1146882
app type =- confluence (com.atlassian.confluence)
Resolution
Jira
Option 1: Jira has a great XML Backup utility and XML backup contains the data (recommended)
Hence, you can use the following steps to update the links in Jira. The approach to achieve this issue is:
- Take a backup of Jira: Backing up Jira.
- Extract the backup file.
- Open the entities.xml file in Notepad or another text editor.
- Search/replace the old Confluence link with the new one (according to your new environment). The replacement options can be found at How to replace all hard coded links after a base URL change.
- Restore the data to JIRA following our documentation: Restoring data.
Option 2: Editing directly from the Jira database
Confluence
XML backup may not be a suitable solution for medium or large size instances of Confluence, so we don't recommend users to replace the links by editing the Confluence XML backup. Instead, we suggest customers to bulk edit the links from the database to replace the old Jira link with the new one (according to your new environment). A resolution to this issue for Confluence can be found at How to bulk update JIRA Issue Macro to point to a different JIRA instance.