Forge remote not working on Confluence globalPage module

Hello,

I’m trying to add Forge remote to our Confluence app which uses the globalPage module.

The changes made to the manifest.yml look like:

modules:
  confluence:globalPage:
    - key: my-forge-app
      resource: main
      resolver:
        endpoint: remote-endpoint
      title: My App
      route: my-app
  endpoint:
    - key: remote-endpoint
      remote: remote-url
      auth:
        appUserToken:
          enabled: true
        appSystemToken:
          enabled: true
resources:
  - key: main
    path: static/my-app/build
app:
  id: ari:cloud:ecosystem::app/0123456-1234-abcd-abcd-0123456789ab
  runtime:
    name: nodejs18.x
permissions:
  scopes:
    - read:app-system-token
    - read:app-user-token
  external:
    fetch:
      backend:
        - 'https://jsonplaceholder.typicode.com'
remotes:
  - key: remote-url
    baseUrl: 'https://jsonplaceholder.typicode.com'

Then in the frontend part:

import { invokeRemote } from '@forge/bridge';

useEffect(() => {
    invokeRemote({
      method: 'GET',
      path: '/posts'
    }).then((response) =>{
      console.log(response);
    }).catch((error) => {
      console.error(error);
    })
  }, []);

But nothing happens.

The app is not rendered and no error is thrown.

I’m using version 3.4.0 of @forge/bridge.

Does anyone know what the problem may be?

Thank you.

Hi @lassenza ,

Is your global page rendered if you remove the call to invokeRemote?

Dugald

Hi @dmorrow,

Even removing the call to invokeRemote (including the import) and keeping only a simple div, the global page still does not render.

Luigi

Hi @lassenza ,

Are you able to identify a stack trace in your web browser console that might be related?

Regards,
Dugald

@lassenza ,

In your previous response you mention using a div component. Is this a UI kit front end? If so, make sure you just use UI kit components.

Dugald

Hi @dmorrow,

Unfortunately there is nothing in the browser console that is related to this problem.

Luigi

@dmorrow,

It’s Custom UI app. It’s already a functioning app. I’ve just removed all components and imports and kept only a div (and React import) to make sure nothing else was impacting the rendering.

Luigi

Hi @lassenza ,

Sorry for your trouble, but there’s not much information for us to go on if there’s no error reported anywhere. Are you able to add an additional confluence:globalPage to the app module with a separate Custom UI implementation and build it out. That might highlight where the problem is.

Regards,
Dugald

1 Like

Hi @dmorrow,

The problem seems to be in a third-party wrapper we are using at root level.

Removing the wrapper the app renders.

I’ll investigate further to understand what may cause the problem, and also if the invokeRemote function works.

Luigi

2 Likes

hey, why do you have the route: my-app ? and have you tried navigating to that route?

That’s just the text that is added automatically to the URL when accessing the global page.

The problem was in an invoke function that we used in a wrapper component to render a third-party component. Removing that, the app renders. Then, I just need to test if the invokeRemote function works as expected.

1 Like

Oh okay… did it work?

Hey @VictorAmadi,
I haven’t tried it yet.
I’ll post if it works once I test it.
Luigi

1 Like

I’ve tested it again on a basic app (essentially only rendering a simple div) and it works as expected.

1 Like