If you profile a Node.js application in production, you know the pain: flame charts full of a, m, and _0x3f2. The original TypeScript function names and file paths are gone, lost during the bundling step. In a previous post, we explored how source maps work under the hood and hinted at what was coming. Today, we're happy to announce that JavaScript and TypeScript source maps are now supported in Polar Signals Cloud.
Source Maps in Action
Here's the same profile, before and after uploading source maps:
How It Works
We covered the internals of source maps in a previous post. Here's how it all comes together:
- Build time: Our bundler plugin (or CLI) injects a debug ID into each JavaScript file and its source map, then uploads them to Polar Signals Cloud.
- Runtime: Parca Agent captures profiles and reads the debug ID from each loaded JavaScript file, linking the profile data to the corresponding source map.
- Query time: When you view a profile, Polar Signals looks up the source map by debug ID and resolves minified names back to your original source.
Getting Started
There are two ways to upload source maps, depending on your build tool. Both integrate into your existing CI build step.
If you use esbuild, install the plugin and add it to your build config:
npm install --save-dev @polarsignals/sourcemap-esbuild-plugin
import {debugIdPlugin} from '@polarsignals/sourcemap-esbuild-plugin';
await esbuild.build({
// ...your existing config
sourcemap: true,
plugins: [
debugIdPlugin({
projectID: process.env.POLARSIGNALS_PROJECT_ID,
token: process.env.POLARSIGNALS_TOKEN,
}),
],
});
Debug IDs are injected and source maps are uploaded automatically at the end of each build.
For any other build tool, use the CLI:
npm install --save-dev @polarsignals/sourcemap-cli
# After your build step
sourcemap-upload dist \
--project-id $POLARSIGNALS_PROJECT_ID \
--token $POLARSIGNALS_TOKEN
Debug IDs are deterministic, rebuilding without code changes produces the same ID, so duplicates are skipped automatically.
That's it. Deploy your application with Parca Agent v0.47.0 or later, and your JS profiles will show original function names and file paths. For the full setup guide, see our Uploading Source Maps documentation.
Sign up for Polar Signals Cloud to try it out. If you need help with a specific bundler or setup, join us on Discord, we'd love to hear from you.