Status 400 when accessing Jira Cloud API endpoints anonymously inside ACE lifecycle hook

I’m trying to add a field to select issues after the addon has been installed. However, when I try to access the currently available fields, I get a status 400.

If I add userAccountId to the httpClient it works.

 addon.on('host_settings_saved', async (clientKey, data) => {
    const httpClient = addon.httpClient({

        headers: {
          'Content-Type': 'application/json',
          Accept: 'application/json',
        url: `/rest/api/3/field`,

Any idea how I can access API endpoints like these without needing a userAccountId inside the install lifecycle hook?

1 Like

Ok, I found a hacky solution.

I needed to wrap my function in a setTimeout and wait 5 seconds before calling it.

Looks like this lifecycle hook gets called a little bit early.