api.asUser().requestJira: GraphQL Error when editing User Properties

I’m attempting to set user properties in my Forge UI Kit 2 app. I’m making the requestJira API call from the resolver index.js file, so that I can invoke the function from my frontend index.jsx through the resolver or call it from a web trigger function.

I have successfully called the following APIs from my resolver index.js using requestJira:

  • GET /rest/api/3/user/properties/{propertyKey}?accountId={accountId}
  • PUT /rest/api/3/issue/{issueKey} (proves that non GET requests work)

So I can GET user properties and I can edit an issue just fine. But when I try to edit user properties with the PUT method or remove user properties with the DELETE method, I get the following error in my browser console and my app halts:

A try/catch in my code will not catch this error.

Here is a cut down version of my resolver/index.js file which results in the error:

import Resolver from '@forge/resolver';
import api, { route } from '@forge/api';

const resolver = new Resolver();

export const setUserProperties = async (accountId, data) => {
  const jsonData = JSON.stringify(data); 
  const resp = await api.asUser().requestJira(route`/rest/api/3/user/properties/external_customers?accountId=${accountId}`, 
    {
      method: 'PUT', 
      headers: {
        'Content-Type': 'application/json', 
        'Accept': 'application/json'
      }, 
      body: jsonData
    }
  );
};

resolver.define('setProperties', async ({payload, context}) => {
  await setUserProperties(payload.accountId, payload.data);
});

export const resolverHandler = resolver.getDefinitions();

I have tried passing empty JSON just in case there was a problem with my data (just curly braces) but that had the same result.

I can successfully set user properties if I make nearly the same call from my index.jsx file using the forge/bridge requestJira function.

import React, { useEffect, useState } from 'react';
import { invoke, requestJira } from '@forge/bridge';

const setUserProperties = async (accountId, data) => {
  const resp = await requestJira(`/rest/api/3/user/properties/external_customers?accountId=${accountId}`, 
    {
      method: 'PUT', 
      headers: {
        'Content-Type': 'application/json', 
        'Accept': 'application/json'
      }, 
      body: JSON.stringify(data)
    });
  };

It seems there is a problem in the forge/api implementation of requestJira that doesn’t play well with non GET requests to the user properties API.

I’m wondering if anyone has run into this, or if there is something I’m missing.