Hey folks,
I’m writing a plugin function for JQL. I have been using the subtaskOf example that is around.
I got it working in my dev environment, so then I installed it as staging on the proper work jira instance.
However, then I noticed something odd, and tried to connect to it with forge tunnel - which notified me it can only tunnel to dev.
So I removed the staging install and then installed the development version on the same Jira cloud instance.
However, now, there is a lingering precompute which is causing issues.
So there’s a bug or anomaly with the precompute system when switching an app’s environment.
See the screenshot attached for the exact details:
My precomputationApi.js is very similar to the provided example:
import api, { route } from "@forge/api";
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql-functions--apps-/
export const fetchPrecomputations = async (orderBy) => {
return await api
.asApp()
.requestJira(route`/rest/api/3/jql/function/computation?orderBy=${orderBy || "UPDATED"}`, {
headers: {
Accept: "application/json",
},
})
.then((response) => response.json());
};
// `precomputations` is a list that looks like this: [{ id: "id", "value": "jql" }]
export const updatePrecomputations = async (precomputations, component, operator) => {
const response = await api
.asApp()
.requestJira(route`/rest/api/3/jql/function/computation`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"values": precomputations
}),
});
console.log(`Update precomputation ${precomputations.map(p => p.id)} (For (${operator}) Component: '${component}') result: ${response.statusText}`);
if (!response.ok)
throw Error(`${response.status}:${response.statusText}`)
};