roadie-backstage-plugins: Backstage Jira Plugin: Proxy Path in `app-config.yaml` is Ignored

The Backstage Jira Plugin has been configure according to the Roadie Documentation found here: https://roadie.io/backstage/plugins/jira/. However, the plugin is failing with the following error in the Backstage UI:

After looking through the modest logging, I found that the apiUrl being used is as follows: /api/proxy/jira/api/rest/api/latest/project/YYYY. When I cURL using this URL, using the following cURL command

curl -vvv -X GET -H “Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXX” https://xxx.xxx.com/jira/api/rest/api/latest/project/YYYY

I get the following:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body>

Found

The document has moved here.

</body></html> * Connection #0 to host xxx.xxx.com left intact

However, when I use the following cURL command, I get the correct data back:

curl -vvv -X GET -H “Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXX” https://xxx.xxx.com/**jira**/rest/api/latest/project/YYYY

Notice that the in the second invocation of the cURL command there is no api after jira. And it delivered the correct results.

The conclusion that I drew here was that the Proxy Path should not be ‘/jira/api’ as it is listed in the Roadie documentation, but should simply be ‘/jira’. When I change the Proxy Path in the Backstage app-config.yaml file to ‘/jira’,

‘/jira’: target: https://xxx.xxx.com headers: Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXX== Accept: ‘application/json’ Content-Type: ‘application/json’ X-Atlassian-Token: ‘nocheck’ User-Agent: ‘Backstage’

I find that that change to the Proxy Path is not being picked up by the Jira Plugin. Looking through the code, it should be picked up and used by the application in the following line:

https://github.com/RoadieHQ/roadie-backstage-plugins/blob/58067422cf6410948e73042903b918cbcc5148fc/plugins/frontend/backstage-plugin-jira/src/api/index.ts#L46

And the apiUrl should resolve the Proxy Path on the following line:

https://github.com/RoadieHQ/roadie-backstage-plugins/blob/58067422cf6410948e73042903b918cbcc5148fc/plugins/frontend/backstage-plugin-jira/src/api/index.ts#L58

Expected Behavior

The Jira Plugin should use the Proxy Path specified in the Backstage app-config.yaml file.

Current Behavior

The Jira Plugin is defaulting to the DEFAULT_PROXY_PATH as defined in the Jira Plugin code on the following line:

https://github.com/RoadieHQ/roadie-backstage-plugins/blob/58067422cf6410948e73042903b918cbcc5148fc/plugins/frontend/backstage-plugin-jira/src/api/index.ts#L26

Steps to Reproduce

  1. Install Roadie Jira Plugin
  2. Change the Proxy Path in the Backstage app-config.yaml file.
  3. The Proxy Path is not picked up in the Jira Plugin.

Possible Solution

Context

The plugin fails to work issuing either a 302 error as noted above. We are demo-ing this plugin to upper management on Friday, and advice on a fix would be much appreciated.

And: When I click on the Go to project --> in the Jira card, I am taken to the following address:

http://localhost:3000/catalog/default/component/undefined/browse/YYYY

Why is this the case?

Your Environment

  • @backstage/plugin-catalog-react version: ^0.6.7
  • @backstage/integration version: ???
  • @backstage/integration-react: ^0.1.15

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I am facing the same issue too as @Makkuusen mentioned, somewhere with the proxy path the api call is unsuccessful from the backstage:

Using JIRA api token auth in Curl which returned the expected data-

curl -D- \
   -u myaccount@xdomain.com:XXXXXXXXXXXXXXXXXX \
   -X GET \
   -H "Content-Type: application/json" \
   https://dummy.atlassian.net/rest/api/3/project/DUM

However with the proxy path as in the following curl - it returned 404

curl -D- \
   -u myaccount@xdomain.com:XXXXXXXXXXXXXXXXXX \
   -X GET \
   -H "Content-Type: application/json" \
   localhost:7007/api/proxy/jira/api/rest/api/latest/project/DUM

@kissmikijr, Thank you for that very nice explanation.

I am having difficult with getting the plugin to work correctly. Any advice would be much appreciated. As I mentioned, I followed the instructions completely, but am still not getting any data back from Jira for the Plugin.

Here is the relevant section of my app-config.yaml:

proxy: ‘/jira’: target: https://xxx.xxx.com headers: Authorization: Basic ${BASE64_ENCODED_EMAIL:API_TOKEN} Accept: ‘application/json’ Content-Type: ‘application/json’ X-Atlassian-Token: ‘nocheck’ User-Agent: ‘Backstage’

The above ${BASE64_ENCODED_EMAIL:API_TOKEN} was formatted from the following string:

harjeetp@xxx.xxx.com:XXXXXXXXXXXXXXXXXXXXXXXXXXX

echo ‘harjeetp@xxx.xxx.com:XXXXXXXXXXXXXXXXXXXXXXXXXXX’ | base64

The Jira API token was defined using the Jira site: Profile --> Personal Access Token --> Create Token

As an aside: I too am puzzled why the following cURL command works:

curl -vvv -X GET -H “Authorization: Bearer XXXXXXXXXXXXX” https://xxx.xxx.com/jira/rest/api/latest/project/XXXX | jq .

When I try any of the variation on the URL, I get either 302 response.

curl -vvv -X GET -H “Authorization: Bearer XXXXXXXXXXXXX” https://xxx.xxx.com /jira/api/rest/api/latest/project/XXXX | jq .

Or a 404 response:

curl -vvv -X GET -H “Authorization: Bearer XXXXXXXXXXXXX” https://xxx.xxx.com /rest/api/latest/project/XXXX | jq .