There’s various problems when using ngrok which I’ve found and here’s some answers that may come in useful.
Problem 1: Installing the authtoken
On a Mac, I’d already installed ngrok using homebrew, so thought I could just add the authtoken
on the command line using
ngrok authtoken ********
…where ********
is your actual authtoken.
This works fine when I run ngrok on the command line, but it seems that if you’ve used the monday
react starter, then ngrok
is actually installed again in an additional place.
I tried looking, but couldn’t find it, so the easiest way I found for adding the authtoken was to update package.json
:
{
...
"scripts": {
...
"expose": "ngrok http 8301",
"ngrok:install:authtoken": "ngrok authtoken ********",
...
}
...
}
Then run
npm run ngrok:install:authtoken
…where ********
is your actual authtoken.
This will install the authtoken and should mean that ngrok now works nicely and behaves itself.
Don’t forget to remove the real authtoken from the file before you commit it to git
Problem 2: Persisting the same ngrok subdomain
With a free ngrok account, each time you restart the web server, you have to update the base URL in the monday.com UI. This gets tiresome quickly.
As I’d already purchased a paid ngrok plan, that allows me to persist the subdomain.
Update your package.json
with your own subdomain:
{
...
"scripts": {
...
"expose": "ngrok http 8301 --subdomain=monday-dev-for-david",
"expose:default": "ngrok http 8301",
...
}
...
}
I’ve renamed expose
to expose:default
and added my own subdomain, so that when I run:
npm run start
… I can always access my app at https://monday-dev-for-david.ngrok.io
even after restarting.
I hope this helps a little.