Flakey Scopes when creating a JIRA issue from a Confluence app

Hello,
I’m building a confluence app with UIKit 1 on the NodeJS runtime. I’d like to create a JIRA issue from the confluence app. I have the app installed on both confluence and JIRA. The scope seems to be flakey, sometimes the create works, other times i get Error: Failed to create issue: {"code":401,"message":"Unauthorized; scope does not match"}. Running an upgrade always says the latest version is running, so its unclear what the issue is.

Please assist.
Syntax

const response = await api.asApp().requestJira(route`/rest/api/2/issue/`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        fields: {
          project: {
            key: projectKey,
          },
          summary,
          description,
          issuetype: {
            name: "Task", // todo 3 - this should be dynamic
          },
        },
      }),
    });

Scopes

- storage:app
    - read:page:confluence
    - read:configuration:confluence
    - write:jira-work
    - write:issue:jira

Hi @ByronBuckley ,

I had a similar issue creating Issues in Jira via 3LO and the rest API. Turns out if I removed the trailing ‘/’ on /rest/api/2/issue/ (in my case it was ‘/rest/api/3/issue/’ ) so its just /rest/api/2/issue. That seemed to fix the issue for me.

I think the Jira API thinks its a different scope with the trailing ‘/’ on the end.

Hope that helps.

Rory