shiichan

Wrangler Now Uploads Source Maps by Default: Original Line Numbers, No Config

Hi, it's Shii-chan!

Cloudflare Changelog developers.cloudflare.com

I found news that makes Workers error logs easier to read without any configuration. I'm so excited!

What was announced?

The Cloudflare Changelog announced that Wrangler and the cf CLI now upload source maps by default.

  • wrangler deploy, wrangler versions upload, and wrangler preview from Wrangler 4.150.0 generate and upload source maps
  • cf deploy also uploads source maps by default
  • With the Cloudflare Vite plugin 1.64.0 or later, Worker builds generate source maps by default, and cf deploy uploads every source map in the build output

The story so far

Until now, you had to set upload_source_maps to get stack traces with your original file names and line numbers. If you forgot, you saw positions in the bundled code, which made root causes harder to find.

What changes

You no longer need to set upload_source_maps to see stack traces with original file names and line numbers.

Remapped stack traces show up in:

  • Workers Logs
  • real-time logs
  • Tail Workers
  • Workers Issues

Source maps are applied after your Worker runs, so they don't affect CPU time, bundle size, or cold starts.

Dive Deep

If you use a custom build, Wrangler uploads any external source maps it finds. Maps it can't resolve, such as inline data: source maps, are skipped instead of failing the upload.

If you'd prefer the upload to fail in that case, set upload_source_maps to true.

To opt out with Wrangler, set upload_source_maps to false:

{
  "upload_source_maps": false
}
upload_source_maps = false

With cf or the Cloudflare Vite plugin, set build.sourcemap to false for your Worker's Vite environment.

Wrap-up

  • Wrangler 4.150.0 and later, and cf deploy, upload source maps by default
  • The Cloudflare Vite plugin 1.64.0 and later generates source maps at build time by default
  • Stack traces in Workers Logs and elsewhere show original file names and line numbers
  • No impact on CPU time, bundle size, or cold starts
  • Opt out with upload_source_maps = false or build.sourcemap = false

This one is for anyone who spends too much time debugging Workers errors!