Links, Applinks, and macros fail when copying Jira and Confluence to other environments

Still need help?

The Atlassian Community is here for you.

Ask the community

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-62850 - Getting 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.

Please refer to https://confluence.atlassian.com/confkb/after-a-successful-server-to-cloud-migration-url-links-are-broken-in-the-new-cloud-instance-1077781093.html


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:

  1. Take a backup of Jira: Backing up Jira.
  2. Extract the backup file.
  3. Open the entities.xml file in Notepad or another text editor.
  4. 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.
  5. Restore the data to JIRA following our documentation:  Restoring data.

Option 2: Editing directly from the Jira database

Editing directly the below SQL statement in the database.

Please Note: We strongly recommend to test the solution in a Staging environment and taking a backup of your database before updating the DB data.

1) Identify the appId for Confluence's app link with the following query:

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';

2) Identify the old Confluence appId or URL by checking the remotelink table:

SELECT * FROM remotelink WHERE URL like '%/pages/viewpage.action?pageId=%';

3) Update the relevant globalid to replace the OLD cloud confluence appId with the NEW confluence appId with the following query:

UPDATE remotelink SET globalid = REPLACE(globalid, 'OLD-APPLINK-ID','NEW-APPLINK-ID') WHERE globalid LIKE '%OLD-APPLINK-ID%';

4) Update the old confluence URL to the new one in the remotelink table:

UPDATE remotelink SET URL = REPLACE(URL, '<OLD_URL>','<NEW_URL>') WHERE URL LIKE '%<OLD_URL>/pages/viewpage.action?pageId=%';

5) Restart Jira to refresh the data cache.

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.




DescriptionWhen 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 in the older environment.
ProductJira, Confluence
PlatformServer
Last modified on Sep 28, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.