Use multiple resolvers for one module

Hi!
I have some modules that are mainly communicating with an external API (Cloudflare). For example:

 jira:adminPage:
    - key: admin-config
      resource: main
      resolver:
        endpoint: cloudflare-remote
      title: Configuration
      useAsConfig: true

But I want to invoke the Forge Store too from the module so I need to add the index where the Forge resolvers located. These Forge resolvers are calling the storage functions like this:

  try {
    const dateFormat = await storage.get("dateFormat");
    const uiColors = await storage.get("uiColors");
    const unitOfMeasurement = await storage.get("unitOfMeasurement");

    return { success: true, data: { dateFormat, uiColors, unitOfMeasurement } };
  } catch (error) {
    console.error("Error retrieving data from storage:", error);
    return { success: false, message: error.message };
  }
});

How can I manage that a module have access to a remote resolver endpoint and the forge resolvers too in the manifest.yml? I can’t add multiple resolvers like this:

      endpoint: cloudflare-remote
      function: resolver

Please help me it is blocking the development of our application.
Thank you very much for your responses! :slight_smile:

@AtlassianDeveloper @AdamMoore can you please help us?

Hey György,

That’s a bit of a tricky one. I’m assuming you can’t call Forge storage directly from the remote (i.e. https://developer.atlassian.com/platform/forge/remote/accessing-storage)?

One way this might be resolved is our upcoming Forge function to remote capability, so you could use a hosted resolver and then route requests to your Cloudfare remote or Forge storage accordingly.

Perhaps you could build your app that way now but using your own auth between the Forge function and your remote (e.g. a shared secret) then swap it out for Forge remote when that is available (should be late June/July). I appreciate that’s extra work but at least you’d be unblocked.

2 Likes

I can call the storage from my Cloudflare worker, but that seemed an extra work and also extra roundtrip between the servers, but I guess that is the only way I can do this now. Thanks for the help!