Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use constructed url for tunnel #3

Merged
merged 1 commit into from Aug 25, 2023
Merged

Conversation

aiji42
Copy link
Contributor

@aiji42 aiji42 commented Aug 16, 2023

While using startTunnel, I noticed it hangs on execution:

const tunnel = await startTunnel({ port: 8787 });
console.log(await tunnel?.getURL()); // This hangs here

Setting the environment variable DEBUG=true and checking the logs, it was apparent that the --url wasn't being passed correctly:

◐ Starting cloudflared tunnel to http://localhost:8787                                                                                                                                                                                                                               You did not specify any valid additional argument to the cloudflared tunnel command.

If you are trying to run a Quick Tunnel then you need to explicitly pass the --url flag.
Eg. cloudflared tunnel --url localhost:8080/.

Please note that Quick Tunnels are meant to be ephemeral and should only be used for testing purposes.
For production usage, we recommend creating Named Tunnels. (https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/)

I believe the reference to options.url here should actually be url:

  const args = [
    ["--url", options.url],
    opts.verifyTLS ? void 0 : ["--no-tls-verify", ""]
  ].filter(Boolean);

Upon patching this locally, I confirmed that the change resolves the issue and everything works as expected.

@pi0 pi0 changed the title fix: bug where url option becomes undefined fix: use constructed url for tunnel Aug 25, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 💯 (sorry for delay somehow missed this PR!)

@pi0 pi0 merged commit 306d5de into unjs:main Aug 25, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants