Skip to content

Replace ngrok with tunnelmole for twilio-run #477

Open
@robbie-cahill

Description

@robbie-cahill

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 the ngrok 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions