Forge Tutorial Part 2: Call a Jira API - Authentication issue

Hey! I am following the tutorial, but I got stuck in part 2. When I create a comment in an issue, and the app is supposed to show the number of comments in the console, the tunnel throws this error:

invocation: c237565e052e4cad index.run
ERROR 21:42:53.859 c237565e052e4cad [NEEDS_AUTHENTICATION_ERR: Authentication required] {
serviceKey: ‘atlassian-token-service-key’
}

Any help will be appreciated :slight_smile:

1 Like

Sorted this first problem. I closed the tunnel, opened it again, refreshed the issue on my test site, and there I was asked to grant the required permissions.

I’ve checked and they appear correctly on my profile Atlassian account

But now I get this very pink text box when I refresh my Jira page :frowning:

image

[comments] is undefined, clearly, because the API call did not work. But why? Anyone else had the same problem?

Any ideas? Thanks!

Hello,
This I also faced, and it was due to the issue having 0 comments (even when adding a comment this issue would appear).
Try to uninstall “forge uninstall”, “forge deploy” and re-installl “forge install” to wipe the app data. If the issue has a comment it should work, if not you can null-safe the Tutorial code (something like “if(comments !== ‘undefined’)”

Were you using “forge tunnel” to tunnel changes made to the app?

1 Like

I’ve uninstalled and reinstalled the app, it works now, excellent advice! I’ll null-safe the code now.

As for your question, yes, I was using “forge tunnel” to tunnel changes made to the app, while following the tutorial.

Many thanks!!!

1 Like