Storage transfer between trigger and webtrigger

Hello,

I would like to access the storage API from a (product) trigger and retrieve a value which was inserted by a webtrigger.

But I have no access from the trigger function. The storage value is undefined. From inside the webtrigger function the value is accessible. Vice versa the webtrigger cannot access storage values created in the trigger function.

manifeset.yml:

modules:
  webtrigger:
    - key: zoom-webtrigger
      function: zoom-func
  trigger:
    - key: issue-trigger
      events:
        - avi:jira:created:issue
        - avi:jira:updated:issue
        - avi:jira:commented:issue
      function: issue-trigger-func
  function:
    - key: zoom-func
      handler: zoomTrigger.run
    - key: issue-trigger-func
      handler: index.issueTrigger
...

Set storage in Webtrigger: (zoomTrigger.js - simplified)

exports.run = async (request) => {
  await storage.set("subscriptions", "Test");
}

Access from Trigger: (index.js- simplified)

export async function issueTrigger(event, context) {
  console.log(await storage.get("subscriptions"));
}

Should it not be possible to exchange data between two modules within one Forge app?

Thank you
Johannes

1 Like

Hi Johannes,

Can you please show how storage is imported in both files?

Hello AlexeyKotlyarov,

thank you for your answer. But the storage access works now. :slight_smile:
I do not understand why, because I have tested it several times.

So the topic can be closed.

Just for info - this was the import statement for both files:

import { fetch, storage, webTrigger } from '@forge/api';

Regards,
Johannes

1 Like