New Forge Tunnel Requirements Limit Ngrok Configurability

The new requirements around using forge tunnel are proving to make local development incredibly difficult. I understand why the change needed to be made to support product requirements of ngrok, but there is no way to configure ngrok now to point to anything other than localhost on a random port or keep a consistent ngrok url. This is particularly important for apps that have oauth configurations or talk to a separate backend locally and need to use specific ngrok url’s or ports.

Previously, for local development, I would run ngrok http app.something.local:8080 which would point the created ngrok url to the specified address locally. I would then update my manifest and deploy to development with the specified ngrok url with blocks like this:

  external:
    fetch:
      backend:
        - https://development-env.auth0.com
        - "*.ngrok-free.app"
        - https://some-generated-url.ngrok-free.app

This let my forge app communicate with a different backend service and reliably go through my oauth flow for signing into a third party app

This configuration can be achieved with an ngrok configuration file under the tunnels block. ngrok docs

You can then start ngrok with that specific tunnel config using ngrok start tunnel-name

The new forge tunnel functionality prevents all of this. It generates a random tunnel name, random port, and uses localhost with no option override.

This should be configurable either in the manifest or command line for the tunnel command. It is pretty standard ngrok usage to set something up in this manner so I would imagine that other developers will run into similar issues.

The current workaround I am trying is to use the generated tunnel ngrok url and port to redirect requests to the actual local url and port I need it to. I’ve yet to get that to work consistently and feels very brittle. If there is a different workaround to use a specific configuration that would be preferred.

2 Likes

Checking if I understand this correctly.

  • Your app has a companion backend service.
  • During development, you:
    • ran an instance of the backend locally
    • pointed a separate ngrok tunnel to it
    • configured the Forge app to talk to it

I’m not sure how the tunnel changes impacted you, but I’m guessing the ngrok tunnel or configuration Forge app uses internally clashes with the manually started backend tunnel.

Can you create a separate ngrok configuration file for Forge to use, and keep your existing backend tunnel workflow intact? Or if my understanding is wrong somewhere, please point it out.

4 Likes

That is correct and my apologies for not being more clear on the need for multiple tunnels portion. I just tried with an udpated paid plan on ngrok. I think that will fix it.

Ngrok free allows multiple tunnels but not multiple agent sessions

Confirmed that works.

2 Likes

gdame, which paid plan did you use? I have the same issue. second local server, but forge tunnel generates random port and supposedly I can use ngrok config to setup multiple tunnels but this won’t work here

Nevermind, was able to configure my ngrok config doing this:

version: "2"
authtoken: *****
tunnels:
  app1:
    addr: 8080
    proto: http
  other:
    addr: 4040
    proto: http

when running forge tunnel, it did not complain of any error related to ngrok and was able to lint, bundle code, and listen for requests just fine.

I ran forge tunnel in vscode where I am working in, and then in separate terminal I ran ngrok start app1 and was able to generate an endpoint to place in my manifest.yml file for my jira app.