Error in Forge App while fetching jira issue data

Hi Team,

We are developing a Jira forge app whch is in Staging, This plug-in worked till last week and now we are seeing below errors though they were any changes to the plug-in

INFO    2024-03-11T08:20:51.390Z bad1ef1f-88b3-4cd3-882a-1383276a30f9 Inside getDescription of issueKey ART01-408
INFO    2024-03-11T08:20:51.456Z bad1ef1f-88b3-4cd3-882a-1383276a30f9  ~ file: checkResponse.js ~ line 8 ~ checkResponse ~ response { code: 401, message: 'Unauthorized; scope does not match' }
INFO    2024-03-11T08:20:51.456Z bad1ef1f-88b3-4cd3-882a-1383276a30f9  getDescription jsonResp = : {"code":401,"message":"Unauthorized; scope does not match"}
ERROR   2024-03-11T08:20:51.456Z bad1ef1f-88b3-4cd3-882a-1383276a30f9 Error while fetching description  TypeError: Cannot read property 'description' of undefined
ERROR   2024-03-11T08:20:51.641Z bad1ef1f-88b3-4cd3-882a-1383276a30f9 Cannot read property 'description' of undefined
TypeError: Cannot read property 'description' of undefined
    at getDescription (aiGeneratedText.js:67044:45)
    at async aiGeneratedText.js:60416:21
    at async asyncMap (aiGeneratedText.js:60347:24)
    at async aiGeneratedText.js:60368:29
    at async aiGeneratedText.js:59758:31

Below is the code

  async function getSummary(issueKey) {
    let strSummary = "";
    console.log(`Inside utils -> getSummary of issueKey ${issueKey}`)
    try{
          const res = await api.asApp ()
          .requestJira(route`/rest/api/3/issue/${issueKey}/?fields=summary`);

        const jsonResp = await res.json();
        checkResponse("getDescription",jsonResp);
        console.log(`jsonResp in useEffect : ${JSON.stringify(jsonResp)}`);
        strSummary = jsonResp.fields.summary;
    }catch(error){
      console.log(" Error while retrieving Summary for the issueKey "+issueKey);
      throw error;
    }   
    // console.log(await response.json());
    return strSummary;
  }

  async function getDescription(issueKey) {
    let description = "";
    console.log(`Inside getDescription of issueKey ${issueKey}`)
    try{
        const res = await api.asApp().requestJira(route`/rest/api/3/issue/${issueKey}/?fields=description&expand=renderedFields`);
        const jsonResp = await res.json();
        checkResponse("getDescription",jsonResp);
        console.log(` getDescription jsonResp = : ${JSON.stringify(jsonResp)}`);
        description = jsonResp.renderedFields.description;
        description = description.replace( /(<([^>]+)>)/ig, '') || '';
    }catch(error){
      console.error("Error while fetching description " , error);
      
      throw error;
    }   
    //console.log(await response.json());
    return description;
  }

Below is the manifest.xml

permissions:
  scopes:
    - storage:app
    - read:jira-work
    - write:jira-work
    - read:jira-user
    - manage:jira-project
    - manage:jira-configuration
    - storage:app   

  external:
    fetch:
      backend:
        - https://api.openai.com

@ChandraSekhar1 support for lenient URL path processing for OAuth 2.0 requests has being removed. This includes requests with trailing slashes, such as your app’s requests to /rest/api/3/issue/${issueKey}/.

Please see the removal notice and the deprecation notice for more details.

If you are unable to find to troubleshoot your specific case, please submit a support request .

3 Likes