Hi,
I would like to access the storage API from a webtrigger and retrieve a value which was inserted by a jira:projectpage
custom UI handler. My source (shortened):
Webtrigger:
import API, { fetch, storage } from '@forge/api';
exports.runAsync = async (request) => {
const someValue = await storage.get("someValue");
debugger;
if(!someValue) {
return {
statusCode: 303,
statusText: 'See Other',
headers: {
'Location': ['http://www.somesite.de'],
}
}
}
return buildOutput(someValue)
};
Custom UI Handler:
import Resolver from '@forge/resolver';
import api, { route, properties, webTrigger, storage } from '@forge/api';
const resolver = new Resolver();
resolver.define('setValue', async (req) => {
await storage.set("someValue", req.payload);
return getUrlForWebtrigger()
});
export const handler = resolver.getDefinitions();
The issue I have is, that the custom UI handler can store “someValue” but the webtrigger can’t load it (someValue
is undefined):
const someValue = await storage.get("someValue");
Based on the documentation, storage Api is shared per site and per product. Since I can’t specify in the manifest that the “webtrigger” is for JIRA, does that mean, I can’t access the same storage in the webtrigger as in the jira:projectPage
custom UI handler?
Thank you
Sven