bubenshchykov / ngrok

Expose your localhost to the web. Node wrapper for ngrok.
https://ngrok.com
2.32k stars 316 forks source link

How to fix Ngrok Custom Subdomain Error when using a free, static domain #320

Open hayata-suenaga opened 6 months ago

hayata-suenaga commented 6 months ago

When you create a free, static domain on the Ngrok dashboard, you get a URL that resembles the one below:

https://<your-static-domain>.ngrok-free.app

I want to use this static domain when running an agent using the JavaScript SDK.

  const url = await ngrok.connect({
    addr: 5001,
    authtoken: process.env.NGROK_AUTHTOKEN,
    subdomain: your-static-domain,
  });

However, I encounter the following error when I attempt this:

failed to start tunnel: Custom subdomains are a feature on ngrok's paid plans.

How can I resolve this issue and use the free, static domain with the JavaScript SDK?

loadstring1 commented 1 week ago

sup there

this worked for me in nodejs SDK (npm ngrok)

ngrok.authtoken(secrets.ngrok)
ngrok.connect({hostname:"your-static-domain",addr:5000})

You need to use hostname instead of subdomain

I hope that helped