question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Expose public URLs for wrangler dev

See original GitHub issue

šŸ’” Feature request

Enable public access of wrangler dev workloads.

Describe the feature

This feature request is the opposite of cloudflare/wrangler#1820 (and any other ā€œrun workers locallyā€ requests): I love that wrangler dev runs workloads on edge servers, but itā€™s unclear if accessing those workloads publicly is possible. Being able to use those workers at an auto-generated, public URL would be ideal.

The specific use-case: most/all of my development work is not done locally, so exposing dev workloads on localhost is incompatible with the way I work across distributed services in the cloud and across providers. Even more specifically, Iā€™d really like to be able to more easily work on workers that are themselves webhook endpoints for other services (like e.g. Stripe).

Describe the alternatives

My current workaround is to either publish the thing to a specific subdomain and then tail the logs or, more often, to spin up something like localtunnel to use as a temporary webhooks endpoint. The first solution is much slower than I expect an equivalent wrangler dev would be. The second solution is both cumbersome and somewhat silly conceptually, since wrangler dev is already tunneling from the edge to localhost and my tunnel is sending that data right back into the public realm through yet-another-network.

Skipping that extra hop altogether and enabling publicly-accessible workloads during dev would improve my Workers workflow considerably!

Itā€™s also entirely possible that Iā€™m mis-reading the documentation. If itā€™s already possible to access dev workloads publicly, then consider this a feature request for updated and clarified docs.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
threepointonecommented, Nov 16, 2021

Assigning this to myself, I want to work on this.

2reactions
isaac-mcfadyencommented, Sep 29, 2022

A solution in the meantime for anyone whoā€™s looking for one is to use Cloudflare Tunnel. Thereā€™s somewhat of a roundabout way to use a dashboard-managed Tunnel that can be activated on demand. Hereā€™s instructions (make sure you install cloudflared first):

  • Run cloudflared tunnel create NAME on your local device that you are testing on. If you skip this step and create a Tunnel via the dash you cannot activate on-demand (itā€™s always on), so make sure you create it this way. Pick a name and substitute NAME for your Tunnel name.
  • Go to the Zero Trust dashboard, and find the Tunnel in the Tunnels menu on the right. Click Configure then Migrate (ignore all warnings, it doesnā€™t matter that your config will be lost because you donā€™t have any yet šŸ˜„).
  • Add any hostnames you want under Public Hostnames, and point them to whatever local services you want (for example, laptop.example.com -> http://localhost:3000/)
  • When you are ready to use your Tunnel, run cloudflare tunnel run NAME on your local device. Note that when this command is not running your Tunnel will not work: this helps protect against accidently leaving your Tunnel running and exposing a service by mistake.
  • You can now access your local services on the Public Hostname you entered! šŸŽ‰
Read more comments on GitHub >

github_iconTop Results From Across the Web

Expose public URLs for wrangler dev Ā· Issue #696 - GitHub
My current workaround is to either publish the thing to a specific subdomain and then tail the logs or, more often, to spin...
Read more >
Wrangler commands - Cloudflare Workers docs
The wrangler dev command that establishes a connection between localhost and a Cloudflare server that hosts your Worker in development.
Read more >
Preview and Publish Your Cloudflare Workers Project
Once we're ready to deploy, we can use the wrangler publish command to deploy it to our unique workers.dev subdomain. View code on...
Read more >
@cloudflare/wrangler | Yarn - Package Manager
Environment variable: WRANGLER_INSTALL_PATH; NPM configuration: wrangler_install_path. Specify binary site URL. In case you need to store/mirror binaries onĀ ...
Read more >
KV store - DEV Community ā€ ā€
If you're going to put your code in a public repo, you should not expose your KV store ID. Just make a copy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found