Bamboo Plans gadget does not load in Confluence due to Trusted App authentication errors

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

  

Summary

Bamboo Plans Gadget not loading in Confluence pages.

Environment

  • Bamboo connected to Confluence through application links and using OAuth as the authentication method.
  • Bamboo gadget feed added to Confluence.

Diagnosis

  1. Navigate to Confluence Administration > Logging and profiling
  2. Add org.apache.http and set to DEBUG, remember to click Save at the bottom to apply
  3. Refresh the page where the Bamboo gadget fails
  4.  Set org.apache.http back to WARN level or remove it

Checking the DEBUG logs, we can see that the gadget is found and retrieved:

2019-12-13 09:32:06,640 DEBUG [http-nio-8443-exec-298] [org.apache.http.wire] wire http-outgoing-499824 >> "GET /rest/gadgets/1.0/g/com.atlassian.bamboo.gadgets:gadgets.planStatus/status/planStatus.xml HTTP/1.1[\r][\n]"
...
2019-12-13 09:32:06,678 DEBUG [http-nio-8443-exec-298] [org.apache.http.wire] wire http-outgoing-499824 << "HTTP/1.1 200 OK[\r][\n]"

Continuing the log review, this can be seen later on:

2019-12-13 09:32:08,859 DEBUG [http-nio-8443-exec-346] [http.impl.execchain.MainClientExec] execute Executing request GET /rest/api/latest/result/PRJ-KEY.json?expand=results%5B0%3A9%5D.result&max-results=10&nocache=1576258328693 HTTP/1.1
...
2019-12-13 09:32:08,916 DEBUG [http-nio-8443-exec-346] [org.apache.http.wire] wire http-outgoing-499833 << "X-Seraph-Trusted-App-Status: ERROR[\r][\n]"
...
2019-12-13 09:32:08,917 DEBUG [http-nio-8443-exec-346] [org.apache.http.wire] wire http-outgoing-499833 << "X-Seraph-Trusted-App-Error: APP_UNKNOWN;[0x9]Unknown Application: {0};[0x9]["confluence:14047965"][\r][\n]"
...
2019-12-13 09:32:08,925 DEBUG [http-nio-8443-exec-346] [org.apache.http.headers] onResponseReceived http-outgoing-499833 << HTTP/1.1 401 Unauthorized
...
2019-12-13 09:32:08,929 DEBUG [http-nio-8443-exec-346] [org.apache.http.headers] onResponseReceived http-outgoing-499833 << X-Seraph-Trusted-App-Error: APP_UNKNOWN; Unknown Application: {0}; ["confluence:14047965"]
...
2019-12-13 09:32:08,931 DEBUG [http-nio-8443-exec-346] [org.apache.http.headers] onResponseReceived http-outgoing-499833 << WWW-Authenticate: OAuth realm="https%3A%2F%2Fbamboo.url%3A443"
...
2019-12-13 09:32:08,948 DEBUG [http-nio-8443-exec-374] [http.impl.conn.DefaultHttpClientConnectionOperator] connect Connecting to bamboo.url/1.1.1.1:443
...
2019-12-13 09:32:08,954 DEBUG [http-nio-8443-exec-346] [org.apache.http.wire] wire http-outgoing-499833 << "{"message":"Access is denied","status-code":401}"

Notice that access was denied due to a Trusted App error.

Cause

The gadget itself can be loaded based on the logs, but Confluence is unable to fetch the contents to populate it due to that 401. Although OAuth is in use, we can see Trusted App errors on the logs. This indicates there are corrupted entries from old app links which used that authentication method in the past. To confirm, run the following queries on the Bamboo database:

SELECT * FROM trusted_apps_IPS;
SELECT * FROM trusted_apps_URLS;
SELECT * FROM trusted_apps;

Solution

If the queries above return any results, remove those entries and recreate the app link as follows:

  1. Stop Bamboo
  2. Take a database backup
  3. Run the following queries to clean up the trusted app entries:

    DELETE FROM trusted_apps_IPS;
    DELETE FROM trusted_apps_URLS;
    DELETE FROM trusted_apps;
  4. Restart the app
  5. Delete the current application link to Confluence
  6. Do the same on the Confluence side for the Bamboo link
  7. Try to recreate the link from any of the apps
  8. Check the results


More information on how app link data is stored in Bamboo can be found here: How to remove Application Links Manually from Bamboo


Last modified on Jan 27, 2020

Was this helpful?

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