Test an app running on your laptop
Hosted HeyBug runs in the cloud, so it cannot reach `localhost` on your machine.
Hosted HeyBug runs in the cloud, so it cannot reach localhost on your machine. A tunnel closes that gap. heybug tunnel start opens a public address for one local port. Test runs that target that address reach your app through it, and HeyBug adds the tunnel key to those runs for you.
Use it while you build. Your app stays on your machine, and the browser runs in the hosted runner.
Before you start
- Your app is running and answers in a browser on this machine, for example at
http://localhost:3000. - You are signed in to the CLI. Run
heybug auth login, or use--token-stdinon a machine without a browser.heybug auth statusshows who you are signed in as. - You know your project id. It is the id in the project's address,
/p/<project-id>.
Steps
-
Start your app and check it loads at the local address.
-
Open the tunnel for its port:
heybug tunnel start --port 3000The command prints one line like this and then waits:
Tunnel tun_<id> open until 15:04: https://<your-heybug-server>/t/tun_<id>/ -> http://127.0.0.1:3000 -
In a second terminal, start a run against the public address (the one ending in
/t/<tunnel-id>/):heybug runs start --project <project-id> --target-url https://<your-heybug-server>/t/<tunnel-id>/ -
Keep the first terminal open until the run ends. Check open tunnels with
heybug tunnel list, and stop one early withheybug tunnel stop <tunnel-id>.
An assistant can run the same test. Once the tunnel is open, call heybug_run with the public address as url. Set HEYBUG_TOKEN and HEYBUG_SERVER for the MCP server first, as in the MCP guide.
Limits
These limits are set in the code. They are not measured figures.
- Length: 60 to 3600 seconds, with
--ttlset to 3600 by default. When the time is up, the tunnel closes. - Open tunnels: two per workspace. A third request fails with "this workspace already has 2 open tunnels; stop one first".
- Bodies: up to 10 MB for each request and each response.
- Wait: the tunnel gives your app 30 seconds to answer each request.
- Queue: the tunnel holds up to 64 waiting requests.
Security notes
- The key is required. A request to the public address without the tunnel key gets "Not Found", the same answer as a tunnel that does not exist. The key goes only to runs that target the tunnel, and the CLI strips it before the request reaches your app.
- Only your port. The CLI sends each request to
127.0.0.1on the port you chose. It cannot be pointed at any other host. - Traffic passes through HeyBug. While the tunnel is open, your app's requests and responses pass through the HeyBug server. Use a test environment with test data and test accounts. Do not tunnel an app that holds real customer data.
- Tunnels are short-lived. Pressing Ctrl-C closes the tunnel. Tunnels are kept in memory, so a restart of the HeyBug server closes every open tunnel.
When it fails
| What you see | Why it happens | What to do |
|---|---|---|
| "Not Found" at the public address | The tunnel expired, was stopped, or the address is wrong. | Run heybug tunnel list, start a new tunnel and use its new address. |
| "The tunnel has ended (expired or stopped)" | The tunnel closed, or the HeyBug server restarted. | Start the tunnel again and update the target address. |
| "The local app on port 3000 did not answer: ..." | Nothing listens on that port, or the app listens only on ::1. | Start the app. Make it listen on 127.0.0.1 or 0.0.0.0. |
"The local app did not answer within 30 seconds. Is heybug tunnel start running?" | The CLI is not running, or your app is very slow. | Keep the CLI open and check the app's slow pages. |
| "Service Unavailable" | 64 requests are already waiting. | Check that the app is not stuck, then run the test again. |
| "this workspace already has 2 open tunnels; stop one first" | Both tunnel slots are in use. | Run heybug tunnel list, then heybug tunnel stop <tunnel-id>. |
| "port must be 1 to 65535 and ttlSec 60 to 3600" | A flag is outside its range. | Use a valid --port and --ttl. |
| "Request bodies through a tunnel are limited to 10 MB." | A request is too large. | Send smaller uploads, or test the upload path on the local app directly. |
The CLI exits with a non-zero code when the tunnel ends. See docs/cli/exit-codes.md for the full list. For more help, see Troubleshooting, and Preview recipes for running a tunnel in CI.