Request working in dev but not prod environment

I’m reviving an app that I haven’t worked on in about a month. I believe when I last used it, everything worked in both the dev and prod environments. Now, a request to create a Jira issue works in dev but not prod. I assume that means there’s an issue with the scopes, but I can’t find the problem. I’ve deployed the updates and then uninstalled and reinstalled. I’ve also run forge lint and that reports some warnings that I don’t trust about finding exported functions, but nothing about permissions.

My request that’s failing looks like the following:

const response = await api.asApp().requestJira("/rest/api/3/issue", {
      method: "POST",
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(payload),
    });

I have the following scopes in my manifest:

scopes:
    - 'storage:app'
    - 'read:confluence-space.summary'
    - 'read:confluence-content.summary'
    - 'read:confluence-props'
    - 'write:confluence-props'
    - 'read:jira-work'
    - 'write:jira-work'

What am I missing? And how can I debug this issue?

I tried deploying to staging to make use of the logs but that failed with the following error:

Error: request to https://deployment-artifacts-914424261525-us-west-2.s3.us-west-2.amazonaws.com/...

Hi @MichaelBelton, it looks like you’re trying all the right things. That all looks like it should be working to me.

I know you said you already deployed and reinstalled, but could you confirm that the output of forge install --upgrade shows that the latest scopes are in use?

Hi @MichaelBelton, I can think of a couple of reasons it can fail:

  • installation is not upgraded (as @RyanBraganza suggested, you can run forge install --upgrade)
  • an app might not be installed into Jira (check the existing installation by running forge install:list and make sure app is installed into both Jira and Confluence)

Thanks for both of your speedy replies!

forge install --upgrade

I hadn’t run this because I’d done full uninstall and reinstall flows as I switched between using the dev and prod versions. When I ran it, I saw it display latest for both the Jira and Confluence install. I ran the command for each option just to try it, but nothing changed :(.

an app might not be installed into Jira

I double-checked and see both products listed with the latest version in the production environment. I first installed the app into Confluence and then used the command the CLI suggested to install it into Jira (nice feature of the CLI :D)

@MichaelBelton could you try running forge deploy -e production and forge install --upgrade after that. If that does not help, would be great if you can share error message and status code of your request.

I copied those commands and ran them. I ran the upgrade command once for Jira and once for Confluence. The request to Jira is still not happening.

How can I get the error message and status code to share with you? In production, I didn’t think I could see anything in the console. In development, it works. And I deploying to staging fails with the error in my original post.

UPDATE: Deploying to staging worked. I’ll add logging and report back.

Solved! Turns out my only Forge-specific issue was that the deploys to the staging environment were failing. Once I could deploy to staging then I found the reason for the request failing was that I’d also updated from the Jira REST API version 2 to version 3.

I saw that version 3 was now listed first in the docs so thought I should use that. The request failed because the issue description is required to use ADF in version 3, but not version 2. When reading more closely I found that version 3 is considered to be in beta so I’ve moved back to version 2.

Thanks for all your help @pvlasov and @RyanBraganza!

2 Likes