Replace ngrok with tunnelmole for twilio-run
robbie-cahill opened this issue · comments
To generate public URLs, twilio-run uses the unofficial ngrok dependency from npm
. This dependency has a few issues:
- As noted in the README for ngrok, its simply a wrapper around the
ngrok
CLI tool. So, you must download and install thengrok
CLI tool as an external dependency and this complicates setup - You need to manually match the version of the ngrok dependency to specific versions of the ngrok CLI client, further complicating setup. You are using version 3.x for twilio-run, its not the latest 5.x version and it does not appear to be documented what ngrok CLI client versions it supports.
- The
npm
dependency is maintained by a third party and is not officially supported by ngrok. So, ngrok could make some unexpected change and the integration might break suddenly. - The
ngrok
CLI tool is not FOSS and is closed source. For some projects, this could create licensing issues if the maintainers are not ok with that for whatever reason.
I propose replacing ngrok
with tunnelmole. Tunnelmole is open source and the runtime is implemented in pure JavaScript.
You only need to add it as an npm
dependency and you don't need to install anything separately. npm
automatically manages all dependencies, you don't need to manually match up versions of anything.
As the runtime code is pure JavaScript, it is automatically cross platform and will run on all operating systems and CPU architectures that NodeJS can run on.
To compare usage:
ngrok
First, download and install ngrok
from ngrok.com, or this won't work. Also, ensure your version of the ngrok
CLI tool is compatible with the version of the ngrok
NPM dependency you are using.
const url = await ngrok.connect(3000);
tunnelmole
const url = await tunnelmole({ port: 3000 });
This works right away, without installing anything separately. It should be fairly straightforward to refactor your code to use tunnelmole
.
Let me know if you'd like to move ahead and i'll create a PR with the changes.
Thank you so much for opening your first issue in this project! We'll try to get back to it as quickly as possible. While you are waiting...here's a random picture of a corgi (powered by dog.ceo)
Hi @robbie-cahill while replacing ngrok with your open-source alternative seems simple, we have a lot of guides (eg. https://www.twilio.com/en-us/blog/6-things-you-can-do-with-twilio-serverless-toolkit) that would also need to be changed then. We also need to ensure that for our customers the process does not get more difficult (for example having to download the self-hosting server).
Therefore I do not see us doing this change any time soon.