Can you please let me know how to restore the deleted docker container and image?
When creating my Forge app, I successfully followed the instructions and created docker container and image, and enabled tunnel.
Today, by accident, I deleted docker container and image supposedly which was created by “forge tunnel” command, even though without container and image the tunneling works as expected so far, but I’m afraid it may then cause issues, as I don’t really understand what docker is responsible for in the context of my Forge app. If possible, can you please tell me how to restore the docker for my forge app (btw, I’m still in development environment)…?
Thank you @rmassaioli for your assistance, do you have idea why I might be having trouble with tunnel connection when running locally Custom UI Forge app?
I get the error: “Unable to establish a connection with the Custom UI bridge.” on localhost:3001 (where my custom UI react app is running).
Could it because my ngrok agent is forwarding to different port (e.g. 51434)?
Hi @Robert_Mian, as @rmassaioli mentioned, when you use the Node runtime, the Docker container is no longer needed when tunnelling. It was previously required because the Sandbox runtime had multiple dependencies so we felt the need to ship a Docker container to emulate the runtime.
As for tunnelling your Custom UI app, I assume that you are following the instructions here? The Custom UI bridge is only defined in the Custom UI Iframe in the product (Jira, Confluence … etc), so what you need to do is to invoke your app as you would normally (e.g - if your app has a Jira issue context module, visit a Jira issue where your app is located), calls will then be proxied to your locally running React dev server.
Hi @BoZhang thanks a lot for elaborated reply. Yes, I indeed follow the instructions you mentioned. I was assuming that my Jira app fails to connect to my local dev because of difference in ports where ngrok forwards to and my local dev server port, or because of not using Docker, however, from your reply I understand that it couldn’t be a problem, now I’m stuck because I don’t know what else could be the issue, as I follow your instructions and it still shows the message in my Jira app: “couldn’t connect to connect localhost: 3000” (this is the port my local dev is running on and it is specified in the manifest). Could you please have a look at screenshots I did and maybe you might locate the issue there? Thanks in advance!
P.S. I see that my Jira app is making requests to localhost:8000, and which I assume is where my tunnel is running. (you can see that in screenshot of Jira app console). Not sure, but thought this info also might be helpful to locate the issue.
Hi, is there anything running locally on port 3000? which port is your React app dev server listening on?
I get the error: “Unable to establish a connection with the Custom UI bridge.” on localhost:3001 (where my custom UI react app is running).
From you previous comment, it might be listening on port 3001? if that is the case, you need to update your manifest to also point to port 3001 like so:
resources:
- key: main
path: static/hello-world/build
tunnel:
port: 3001
@BoZhang thanks for helping me out. But the reason of inconsistency between my last and previous message, is that I tried both ports. In my last attempt, which screenshots in my last message are related to, port is set to 3000, react app is running on 3000 port, and message is couldn’t connect to connect “localhost: 3000”. Is there anything I might be doing wrong?
Ah ok, so the Forge tunnel should proxy the request over to localhost:3000, from that error message it seems like there is some issue with the React app dev server.
Can you try hitting port 3000 directly and see what you get (like curl localhost:3000).
Hmm, you would only get this error if the local server spawned when running forge tunnel couldn’t proxy the request over to your React app dev server because of ECONNREFUSED. Can you try configure different ports? I am not too sure why you would get this error, the setup looks good.
@BoZhang If I understand correctly, ngrok tries to connect to my localhost:3000 and serve it to Atlassian cloud, if yes, in this case when directly hitting the port might work, it can be refusing to connect from outside. Is my way of thinking correct?
Btw, the problem is only with custom UI setup, when using Forge UI kit (e.g. without react app), it works perfectly fine. That is why I think it is because ngrok is failing to connect with my localhost:300 … however I might be off the track here… please let me know
No, Ngrok creates a tunnel for a locally running NodeJS server spun up when you run forge tunnel (listening on port 8000). This process is attempting to proxy requests to your React app server (listening on port 3000).
I wonder if it something to do with how localhost is being resolved on your machine, I see the following bug being reported by others as well.
@BoZhang thanks for sharing. It seems the issues is connected to node version. If I upgrade the version to node 20 or 21 (now I’m running on 18), will Forge runtime be compatible with node 20? e.g. I will replace:
That’s annoying, we don’t have a NodeJS 20 runtime available at the moment, but that is only for deploying your code. When you use the tunnel locally, the Node runtime version doesn’t matter, it will be what you have locally. I guess you try bumping your locally running NodeJS version up and down and see if that helps you out.