My Forge App only Loads when I'm Tunneling the app from my local pc

Hi everyone

I built an app with forge platform, everything was working fine, but for the last two days, the app only loads when I run the forge tunnel from my vscode, and If I didn’t do that, the app doesn’t load on my atlassian project account. it says localhost refused to connect.

the app uses CUSTOM UI, I tried to uninstall/install the app, but doesn’t solve the problem

anyone knows how to fix this?

1 Like

IF someone could help me out I would be really thankful

I even create a new forge app with Forge Create → Jira Custom UI app
then built my react app and Forge Deploy && Forge Install it.

but still the app only loads when I run Forge Tunnel from my vscode

Where are you hosting your custom ui at ? When you’re not tunnelling - the requests should be hitting that server. Can you check the logs on it to see what the errors are?

1 Like

You mean host it on a third-party server? I don’t host it anywhere.

I just create a custom ui app with forge templates, then deploy and install it.
it was reachable for the last week, but since two days ago, it only works when I run the tunneling from my local pc.

there is no errors, when I click on the app on my dashboard, only a white blank page appears.

1 Like

Sorry - my brain got confused with the connect hosting within forge feature.

Anyways - if you’ve deployed the app - then it should working the same. Check your javascript console to see if there are any errors there. Have you added in the CSP settings (https://developer.atlassian.com/platform/forge/add-content-security-and-egress-controls/ )?

If you’re doing a react app - you’ll need to add ‘unsafe-inline’ .

But check the javascript console - it will more than likely tell you more.

It’s okay. thanks

There is nothing wrong the CSP. and there is no Error on my console either.
The problem is the app doesn’t load without tunneling, even I deploy and install it multi times on my dashboard and it behave like this in the last two days.
before that app was working fine. I even rebase my code base to 4days ago, but nothing changed

This is my manifest.yaml , maybe that helps:

modules:

  jira:projectPage:

    - key: some-key

      resource: main

      resolver:

        function: resolver

      title: The Title

  function:

    - key: resolver

      handler: index.handler

resources:

  - key: main

    path: static/MyApp/build

app:

  id: ari:cloud:ecosystem::app/{the-app-id}

  name: App Name

permissions:

  scopes:

    - 'read:jira-user'

    - 'read:jira-work'

    - 'write:jira-work'

    - 'storage:app'

    - 'manage:jira-configuration'

  content:

    styles:

      - 'unsafe-inline'

    scripts:

      - 'unsafe-eval'

      - 'unsafe-inline'

  external:

    images:

      - '*.gravatar.com'

      - '*.wp.com'
1 Like

I think I fixed the problem.

The Problem was related to ‘react-router-dom’

I used it for routing in my react app, and for my root page ( the ‘/’ page ) I used the exact attribute .

before :
<Route exact path='/'>

after:
<Route path='/'>

and I think this was the conflict for Forg to find out how to print the first page, So I was keep getting blank white page without any errors.

the weird part that confused me was that the app worked fine with Forge Tunnel , and that was the reason that I thought maybe the problem is related to Tunneling.

2 Likes

I had the same problem today. When I checked browser’s logs, I have seen that forge can’t load static assets for my custom UI.


When I building my custom ui, it writes following statement in the logs:

The project was built assuming it is hosted at /
You can control this with the homepage field in your package.json.

So I have added “homepage”: “.” to my package.json file of custom ui and build it again. This fixed the issue.

4 Likes

@Shahryar I have the same problem like you, but I use react router with useRoutes. do you have an idea how I can fix this problem?