What are the expected use-cases of invokeRemote?

I’d like to know if I ought to use invokeRemote() from my resolver. I’m looking to data from a 3rd party site. No auth is required, it’s a simple GET to a public site (specifically, it’s fetching a list of public holidays, but that’s not important).

I was using fetch() from @forge/api and it worked fine.

I thought, since I’ve declared a remote in my manifest (I think I need to do that so that whoever’s installing my app will be told that it’s going to get information from this 3rd party site, right?), I should use that. So I’m trying to replace fetch(new URL(3rdpartySite)....) with invokeRemote(keyTo3rdPartySiteRemote, ...). However, I’m getting a HTTP 400 status code in my tunnel output, with the message ‘INVALID_REMOTE_ERR: Invalid remote key provided: keyTo3rdParthSiteRemote’ (though it is the correct remote key, I presume there’s a problem with it somehow).

So before I spend too much time digging into why this isn’t working… is it supposed to work like this? All the examples of invokeRemote seem to be much more complicated, requiring auth, endpoints, and a lot more YAML. It seems overkill for something I already had working in just a few lines of JS. Is “a simple GET from a simple site” one of the use-cases of invokeRemote?

@PaulHicks,

No. If you had fetch working, there’s no reason to use invokeRemote.

But I can see your confusion. Here’s what the docs say about Forge remote use cases:

  • Create an integration app that sends or receives data between an Atlassian product and a third-party product.
  • Invoke a complex existing application, for example, your own customized large language model that provides AI services to your app that runs on a non-Atlassian platform.

To me, those use cases are indistinguishable from fetch. So let me try to adjust those definitions to better differentiate:

  • Create an integration app that sends or receives data between an Atlassian product and a third-party product where you control the 3rd party auth & infrastructure.
  • Invoke a complex existing application, for example, your own customized large language model that provides AI services to your app that runs on a non-Atlassian platform that you control.

I’ll have a conversation with Forge team and see if we can update our docs so others don’t fall into the same confusion.

2 Likes