Source maps

See errors at src/checkout.ts:42 instead of index-3f9a2c.js:1:48213.

Set it up

  1. In Organization settings → API keys, create a key with the Source maps preset.
  2. Add it as DATABUDDY_API_KEY to the environment your production build runs in (CI, Vercel, Netlify). Not your laptop: builds without the key upload nothing and stay exactly as they were.
  3. Add one of these, then deploy.
vite.config.ts
import { databuddySourceMaps } from "@databuddy/sdk/vite";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [databuddySourceMaps()],
});

Vite 4 or later. Turns on hidden maps, uploads them after vite build and deletes them from dist.

The website comes from the Client ID your app already sets (NEXT_PUBLIC_DATABUDDY_CLIENT_ID, or VITE_DATABUDDY_CLIENT_ID including from .env). Set DATABUDDY_WEBSITE_ID if there's none.

There's no release or version to set. Maps match errors by file name, so built files need a content hash in their names, which Vite and Next.js add by default.

A failed upload never fails the build: the plugins print what went wrong and the build goes on. Set failOnError: true to fail it instead.

Needs @databuddy/sdk 3.10+ and Node.js 18+. Works in ES module and CommonJS configs.

Options

Plugin optionCLI flag
apiKeyThe key. Default DATABUDDY_API_KEY, the only way the CLI reads it, so it stays out of build logs.
websiteId--website-id <id>The website, when no Client ID is set. Default DATABUDDY_WEBSITE_ID.
stripSources: true--strip-sourcesUpload without your code. Frames still map to file, line and function.
failOnError: trueAlways onFail the build when an upload fails
Automatic--deleteDelete the maps after uploading. The plugins do it unless you turned maps on yourself.
--dry-runList what would upload, without a key
concurrency--concurrency <n>Parallel uploads, 8 by default
apiUrl--api-url <url>Default DATABUDDY_API_URL, then https://api.databuddy.cc

Unchanged maps aren't sent again, so uploading on every deploy is cheap. For your own scripts, uploadSourceMaps(dir) from @databuddy/sdk/sourcemaps is the same uploader.

Not working?

Every line the tools print starts with Databuddy. A working build prints Databuddy source maps: 12 uploaded, 0 already stored, 0 failed. If that line is missing, the plugin didn't run in that build.

It saysFix
Set DATABUDDY_API_KEY to an API key…The build ran without the key. Add it to the environment your production build runs in, then redeploy.
Set DATABUDDY_WEBSITE_ID to your website's Client IDNo Client ID was found. Set DATABUDDY_WEBSITE_ID, or pass websiteId.
Databuddy didn't accept the API keyThe key is incomplete or revoked. Create a new one with the Source maps preset.
The API key can't upload source maps for this websiteThe key lacks the Source maps permission or belongs to another organization.
Databuddy has no website with the ID …The ID is wrong. Copy the Client ID from your website's tracking setup.
Couldn't reach …The build machine is offline or DATABUDDY_API_URL is wrong. The build went on without maps, so this deploy's errors stay minified until you deploy again.
Databuddy's API had a problem (HTTP 5xx)Our side failed five times in a row. The build went on without maps; deploy again in a few minutes.
… isn't a full web address or … isn't httpsFix DATABUDDY_API_URL, or remove it.
Source maps can be up to 25 MBTurn on stripSources, or split the bundle into smaller chunks.
found no source maps (.js.map files) to uploadSource maps are off, or the CLI got the wrong folder. Remove build.sourcemap: false, or pass the folder your build writes.
There's no folder at …The CLI's folder doesn't exist. Run it after the build, from your project's root.
sourcesContent is missing from …Stacks show files and lines but no code. Turn on sourcesContent in your bundler.
… has the same name, and Databuddy keeps one map per nameAdd a content hash to built file names.
build.sourcemap is true or productionBrowserSourceMaps is trueYour maps stay public. Remove the setting (Vite: set "hidden") to have them deleted after upload.
the maps are still in …The CLI ran without --delete. Add it if that folder gets deployed.
couldn't find which Next.js version or … with Turbopack can't uploadUse Next.js 15.4.1+, or run databuddy sourcemaps upload .next/static --delete after next build.

Skip uploads if your website serves maps

When a file has no uploaded map, Databuddy reads the map its script points to (sourceMappingURL comment, SourceMap header or data: URL), only from your website's domain and subdomains. Uploading is still better: your code stays private, and old builds keep mapping after you deploy over them.

Who sees your code

Original file, line, functionLines of code
Members who can manage source mapsYesYes
Viewers and read-only API keysYesNo
Public dashboard visitorsNoNo

Maps are stored privately with Tigris, never served or published, and deleted with their website or organization.

Limits

One map25 MB, sent with Content-Length
Uploads2,000 an hour per website and per API key; 10 GB a day per organization. Over either: 429 with Retry-After, which the tools wait out.
File namesLetters, digits and . _ - ~ @ + [ ], ending in .js.map, .mjs.map or .cjs.map
Kept for30 days after upload, renewed weekly while the map keeps showing errors

How is this guide?