I am trying to call invokeRemote
from a Custom UI module, which keeps throwing.
The error from the rejected promise in the Custom UI looks as follows:
Error: There was an error invoking the function - Resolver has no definition for 'undefined'.
There is also an error in the app log console that looks like this:
Error: Resolver has no definition for 'undefined'.
at Resolver.getFunction (webpack://my-app/node_modules/@forge/resolver/out/index.js:44:1)
at Object.resolve (webpack://my-app/node_modules/@forge/resolver/out/index.js:52:1)
at r.<computed> [as handler] (/var/task/index.cjs:2:139447)
at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)
The fact that the @forge/resolver
package is looking for a resolver named undefined
does not seem right. I cannot tell if this is a user or library error.
I tried to update my @forge/resolver
package to the latest version but that did not help.
The request never hits my remote server.
My manifest contains these configurations (module details omitted):
app:
id: ari:cloud:ecosystem::app/123
runtime:
name: nodejs18.x
connect:
key: my.app.key
remote: connect
authentication: jwt
remotes:
- key: connect
baseUrl: https://my-remote.example.com
modules:
endpoint:
- key: connect-endpoint
remote: connect
jira:adminPage:
- key: my-admin-page
resource: r-NeVU2u
title: My admin page
layout: blank
resolver:
function: my-function-key
# UI modules, permissions, etc.
Happy to share more details and appreciate if anyone has some input. Thanks!
1 Like
Hi @tbinna, I am not too sure where the @forge/resolver
package comes into play here, that package is to help with native Forge functions. invokeRemote
lives in the @forge/bridge
package, are you able to provide a code snippet?
I found the issue. The problem is in my app manifest.yml
where the resolver
property of the UI module has to point to an endpoint and not to a function:
app:
id: ari:cloud:ecosystem::app/123
runtime:
name: nodejs18.x
connect:
key: my.app.key
remote: connect
authentication: jwt
remotes:
- key: connect
baseUrl: https://my-remote.example.com
modules:
endpoint:
- key: connect-endpoint
remote: connect
jira:adminPage:
- key: my-admin-page
resource: r-NeVU2u
title: My admin page
layout: blank
resolver:
endpoint: connect-endpoint
# other UI modules, permissions, etc.
Ahh, that would do it. While we are on the subject of debugging, we also emit some very basic logs for remote invocations that can be viewed through the developer console (if you haven’t come across it already). It might come in handy for debugging.
1 Like
@BoZhang, is my understanding correct that once a module opts into resolving from an endpoint, the same module cannot also call invoke
to call into a Forge backend (i.e., call a resolver function)?
Yeah, unfortunately, you can’t mix and match. However, there is a feature coming soon that will allow you to call out to your remote from a Forge resolver (“Forge function to remote” under this board). It’s not as good as being able to configure your module to call both directly, but it will still allow a module to use Forge resolver functions and remotes.
1 Like
Thanks! It is unfortunate that we cannot mix, but it sounds like the “Forge function to remote” feature will solve that problem. That may be quite a good solution because the Custom UI can go back to a regular resolver and let the Forge function handle the interaction with the remote—transparently to the front end.
2 Likes
Hey @tbinna it is an enhancement we’re thinking about for future. I’ve created a FRGE ticket to track it.
4 Likes
Hello, Please I am fairly new to developing Atlassian applications, I’m trying to build my own backend and use Forge as the front end but I am having issues and no luck. Drop some ideas on me please