Skip to content

lightgun-poc / lib/tunnel / startNgrok

Function: startNgrok()

startNgrok(port, d?): Promise<Tunnel>

Defined in: lib/tunnel.ts:201

Brings up (or adopts) an ngrok endpoint for port.

The URL comes from the agent's documented local API rather than by scraping its log lines, and an agent that is already running is reused instead of fought with — the free plan allows one session, so spawning a second one just fails.

Parameters

port

number

d?

NgrokDeps = {}

Returns

Promise<Tunnel>

Throws

When the binary is missing, the agent dies, or no endpoint appears before timeoutMs. Callers are expected to keep serving anyway: a tunnel is a convenience, and the USB and LAN flows are unaffected by its absence.

Released under the MIT License.