Subscribe to receive notifications of new posts:

Introducing workers.new, custom builds, and improved logging for Workers

04/16/2021

3 min read
Developer Working

Cloudflare Workers® aims to be the easiest and most powerful platform for developers to build and deploy their applications. With Workers, you can quickly solve problems without having to wonder: “is this going to scale?”

You write the JavaScript and we handle the rest, from distribution to scaling and concurrency.

In the spirit of quickly solving problems, we’re excited to launch three new improvements to the Workers experience, so you can take your next idea and ship it even faster.

Introducing... workers.new

Address Bar

First, we’re introducing https://workers.new, a shortcut that takes you directly to a JavaScript editor for creating a new Worker. Anytime you have a cool idea, need a quick fix to a problem, or just want to debug some JavaScript, you now have a simple way to go from idea to prototype. What’s more is you don’t even need to deploy the Worker to try it out!

Screenshot

We’ve also updated the default Worker template to help you go a few steps beyond the typical “Hello, World!”. When you open the editor, you’ll now see a few examples that demonstrate how to redirect requests, modify headers, and parse responses.

Customize your build scripts

Wrangler Crab

For developers who want to deploy more complex applications, like those with external libraries or written in other languages like TypeScript, we recommend using our command-line tool, wrangler.

Previously, wrangler has supported three project types: JavaScript, Rust, and webpack. By far, we’ve found that webpack is the most widely used among the community, since it has built-in support for bundling npm packages. Yet, as more developers started to use wrangler, they’ve wanted to customize their webpack configurations or even use other JavaScript bundlers.

That’s why we’re excited to release custom builds for wrangler! Now you can provide wrangler with a custom build script and upload directory, which works with all of the wrangler commands including wrangler dev and wrangler publish.

Sample Script

This means you can use any JavaScript bundler you want: webpack, Rollup, Parcel, esbuild, and many more! We’ve put together a few templates that you can copy if you want to get started with custom builds. Make sure to update wrangler to release 1.16 or later and check out our documentation about custom builds and additional configuration options.

Viewing logs and exceptions

Ever wanted to see the console.log() output or uncaught exceptions from a deployed Worker?

In case you missed it, wrangler tail allows you to see a live stream of your Worker’s logs and exceptions. Today, we’re improving wrangler tail by making it easier to use and more accessible to developers.

First, we wanted to improve the terminal output. Previously, wrangler tail would only output log entries as JSON. While this was useful when piping through to tools like jq, it was generally hard to digest. That’s why we created a new “pretty” format that is much easier to read and takes full advantage of your terminal’s color codes.

$ wrangler tail --format=<json|pretty>
Sample Code

If you have suggestions for how we can improve wrangler tail, feel free to pop in the #wrangler channel on the Workers Discord. We’re excited to see what you ship with these improvements!

A sneak preview

As we like to say at Cloudflare, we’re just getting started. While we have plans to add improvements to wrangler... where else could we introduce logs?

Dashboard Logs

Stay tuned.

We protect entire corporate networks, help customers build Internet-scale applications efficiently, accelerate any website or Internet application, ward off DDoS attacks, keep hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
Developer WeekDevelopersCloudflare WorkersWranglerProduct News

Follow on X

Ashcon Partovi|@ashconpartovi
Cloudflare|@cloudflare