Uncaught (in promise) Error: Expected reject to be called with Error, got [object Undefined]

After adding the write:jira-work scope to my app, it does not work on its existing installations.

What I see in the browser:

  • It asks for permissions. This is expected, because a new scope was added.
  • Clicking the button to grant permissions goes through the normal 3LO flow.
  • On returning to the app’s page it fails to complete loading.
  • There is an error in the JS console: Uncaught (in promise) Error: Expected reject to be called with Error, got [object Undefined]
  • On the back end there is this error: [NEEDS_AUTHENTICATION_ERR: Authentication Required] { status: 401, serviceKey: ‘atlassian-token-service-key’, options: undefined }

This appears to be a repeat of this report from 2 years ago.

That first step does not look right. “Simplified user consent” should mean that there is no need for a per-user reconsent for newly published versions of apps. I’ll bring this up with the right team tomorrow!

1 Like

Thanks @rmassaioli ! I really appreciate it.

Hey @PeterBrownlow,

Just wanted to clarify, if your app has an existing or newly added scope that required manual consent like read:me, the version bump for when that scope was added, and all future major version bumps for the app will still require manual consent from the user. Simplified User Consent is not yet smart enough to consider previous consent grants from users when giving looking at consent for new updates.

I am looking into the error that you faced however where on returning to the app page after consenting, the app doesn’t load.

If you had more details to share like what module you are using and what existing scopes your app has, that would be useful to help diagnose the issue.

If you could also share your app id that would also be helpful for us to try and find logs for your app.

Thanks!

Hi Matthew,

Here are more details.

  • The error is visible to users in both my jira:projectPage & jira:projectSettingsPage modules.
  • I have triggered it by adding the write:jira-work scope to both these sets of previous scopes:
    • read:jira-work & read:me
    • read:jira-work, read:me & storage:app
  • Merely adding the new scope & deploying is sufficient to trigger the error. No new code that uses the scope is required.
  • In my resolvers I am calling Jira REST APIs asUser(). I have not tried asApp().
  • My app id is ari:cloud:ecosystem::app/0befd9ab-9912-4e39-8235-179e70e8a416.

-Peter

Hi @PeterBrownlow, apologies, we believe that there is a bug in one of our systems, we are now working to fix it.

As a workaround to unblock you; you can hit the Remove Access button on the Manage apps page for your app, this will reset the state of the consent (which is currently in a bad state, due to the bug). Because your app has the read:me scope, you will have to provide manual consent via the interactive prompt.

Apologies again for the inconvenience. Please let us know if you run into any other problems.

Thanks!

Hi @PeterBrownlow, a quick heads up that we released a bug fix late last week, the issue should be resolved now. Please let us know if you run into any other issues.

Thanks!