epok
View as Markdown

Upload source maps

Updated Nov 22, 2026 · today

If your frontend ships minified JavaScript, browser errors reach Epok as a.min.js:1:74213 and stay that way until you upload the maps. Upload is a plain HTTP POST from your CI, one call per bundle per release. After that, expanding a frontend error in the app shows your original file, line, and function name.

Time to first symbolicated stack: ~15 min; Needs: RUM already reporting errors (set that up first); API key: app.epok.cloud, then Settings, then API Keys

First, the failure you will actually hit

The maps upload, CI goes green, and the stacks stay minified. Nothing errors, because nothing can. The upload endpoint validates the map and stores it; whether that map ever matches a real frame is decided later, by four things that have to line up. Get them right before you wire the call in and you skip the whole debugging session.

  1. url is the URL the browser loads the bundle from. It is not the build-output path (dist/assets/app.min.js) and not a relative path (/assets/app.min.js). Maps are looked up by exact string match against the URL in the stack frame, so it must be the full absolute URL your CDN or origin serves, character for character. This is the constraint that breaks most first attempts: the value sitting in your build script is almost never the value the browser reports.
  2. release must equal the release your browser build reports. The browser SDK stamps initRum({ release }) on every error as service.version, and the in-app error view resolves each error only against the maps uploaded for that same release. It never falls back to the newest map: an error from yesterday's build, still running in an old tab, resolved against today's map would show a plausible but wrong line, which is worse than no answer. So an error with no release, or a release you did not upload maps for, shows its raw frames with the note no source map for this release. The match is an exact string match with no normalization, so v1.4.2 and 1.4.2 are different releases. Use one variable for both the build and the upload.
  3. Lines are 1-based, columns are 0-based on the resolve call. Browser stack traces print 1-based columns, so subtract one from a column you parse out of a stack string (the app does this for you). Skip that and the column lands in a neighbouring mapping and returns a wrong-but-confident answer. Both fields must be JSON numbers; a quoted "128" is ignored and the frame passes through unresolved.
  4. Frames with no map pass through untouched and are returned unchanged rather than erroring, with an unresolved_reason such as no_map_for_release. That is deliberate: vendor bundles routinely ship no maps, and a stack that is half-resolved is far more useful than a request that fails. The cost is that a partial upload is indistinguishable from a partial failure at a glance. Check the resolved count in the response, not whether the call succeeded.

Wire the upload into CI

The call belongs immediately after your bundler step, in the same job, keyed off whatever id you use to name the build. Run it before you deploy: maps uploaded after an error happened still work (resolution is live, not a reprocessing pass), but maps uploaded before the deploy mean the first production error is already readable.

The body is {"release", "url", "map"}, where map is the source map itself: either the parsed JSON object or the raw file contents as a string. Gzip the body. That is not an optimization: app.epok.cloud caps request bodies at 2 MB on the wire, and an uncompressed map for any non-trivial bundle clears that on its own. Source maps are JSON and compress roughly ten to one, so Content-Encoding: gzip is the thing keeping a normal map under the cap. Uploading needs a key with the symbols:write scope. Create one in Settings, then API Keys, then Custom, and keep it in your CI secrets. The ingest key is refused with a 403 that names the scope: it ships inside your public JavaScript, so anyone could read it and upload a map that rewrites your stack traces.

ci-upload-sourcemaps.sh
bash
RELEASE="$(git rev-parse --short HEAD)"   # the SAME id your browser build reports
# EPOK_SYMBOLS_KEY: a key with the symbols:write scope, stored as a CI secret.
# Never the ingest key: that one ships in your public JavaScript and is refused here.

for map in dist/assets/*.js.map; do
  # The URL the BROWSER loads this bundle from; not the path on disk.
  bundle="https://cdn.example.com/assets/$(basename "${map%.map}")"

  jq -n --arg release "$RELEASE" --arg url "$bundle" --slurpfile map "$map" \
     '{release: $release, url: $url, map: $map[0]}' \
  | gzip \
  | curl -sSf -X POST \
      "https://app.epok.cloud/api/v1/tenants/$EPOK_TENANT_ID/sourcemaps" \
      -H "Authorization: Bearer $EPOK_SYMBOLS_KEY" \
      -H 'Content-Type: application/json' \
      -H 'Content-Encoding: gzip' \
      --data-binary @-
done

# each call -> {"status":"ok","release":"9f3c1ab","url":"https://…","bytes":214893}

The map is parsed before it is stored, so a truncated or malformed map is rejected at build time with a 400 rather than discovered during an incident. bytes in the response is the stored (compressed) size. Re-uploading the same release and URL replaces the previous map.

EPOK_TENANT_ID is the numeric account id your key belongs to, and it has to match the key, because the path and the credential are checked against each other. That is a helpful constraint rather than a guessing game: get it wrong and you get a 403 reading API key does not match tenant, immediately and unambiguously, so a single upload attempt tells you whether the value is right.

Do not point this at ingest.epok.cloud. Source maps are app-plane endpoints. The host is app.epok.cloud, and the same key can behave differently across the two planes (see Authentication).

See what CI actually uploaded

This is the fastest way to check constraint 1 and 2, because the stored url and release are right there to compare against what the browser reports. The listing returns the 500 most recent uploads, newest first. Reading it needs a key with read scope: a symbols:write-only CI key uploads fine and then gets a 403 here, which is expected, not a bug.

bash
curl -s "https://app.epok.cloud/api/v1/tenants/$EPOK_TENANT_ID/sourcemaps" \
  -H "Authorization: Bearer $EPOK_READ_KEY" | jq .

# {
#   "sourcemaps": [
#     {
#       "release": "9f3c1ab",
#       "url": "https://cdn.example.com/assets/app.min.js",
#       "byte_size": 214893,
#       "created_at": "2026-07-20T11:04:18.221084+00:00"
#     }
#   ]
# }

Resolve a frame end to end

The resolve endpoint symbolicates minified frames on demand, up to 100 per call. Send the release, and frames of {url, line, column} with line 1-based and column 0-based. Frames resolve only against maps for that exact release; an empty release resolves nothing. This call is how you prove the whole chain works before an incident makes you care.

bash
curl -s -X POST \
  "https://app.epok.cloud/api/v1/tenants/$EPOK_TENANT_ID/sourcemaps/resolve" \
  -H "Authorization: Bearer $EPOK_READ_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "release": "9f3c1ab",
    "frames": [
      {"url": "https://cdn.example.com/assets/app.min.js",
       "line": 1, "column": 74213}
    ]
  }'

Resolved frames come back with their original fields intact plus original_source, original_line, original_column, and original_name when the map records one. resolved counts how many frames were symbolicated, which is the number to assert on in a smoke test. Every frame left unresolved carries unresolved_reason, and unresolved counts them by reason: no_release, no_map_for_release, map_missing, map_invalid, map_too_large, map_parse_refused, request_budget or position_not_mapped.

json
{
  "frames": [
    {
      "url": "https://cdn.example.com/assets/app.min.js",
      "line": 1,
      "column": 74213,
      "original_source": "src/checkout/PaymentForm.tsx",
      "original_line": 128,
      "original_column": 22,
      "original_name": "submitPayment"
    }
  ],
  "resolved": 1,
  "release": "9f3c1ab",
  "unresolved": {}
}

Verify it's working

  1. Trigger a frontend error on the deployed build.
  2. Open RUM in the app and find it under Recent frontend errors. Errors show up within seconds of the browser exporting them.
  3. Click stack on the error row. The frames resolve on expand. The first expansion against a large map pays for parsing it, and the parsed map is then cached, so later expansions of the same bundle are quick. Resolved frames render as at submitPayment src/checkout/PaymentForm.tsx:128 with a ● mappedmarker. Unmapped frames keep their raw minified line; when the error's release has no map, the stack says no source map for this release.

Because resolution happens at expand time and not at ingest, uploading a map during an incident retroactively fixes stacks that were captured before it existed. There is no reindex to wait for.

Branch A: the upload itself is rejected. A 401 means no key was parsed from the request at all; a 403 means the key was read but is wrong for this call: either it lacks the symbols:write scope (an ingest key always does), or it belongs to a different tenant than the tenant_id in the path. Check the scheme you sent against the per-plane table in Authentication and remember these are app-plane endpoints on app.epok.cloud, not ingest. A 413 is two different limits sharing one status code, and the first is the one you will actually meet: 2 MB on the wire, enforced at the edge on whatever bytes you send, measured after gzip, which is why the snippet gzips. Separately, the app refuses a map over 24 MB decompressed. So a 30 MB map that gzips to 1.5 MB gets past the edge and is then rejected by the app, so split the bundle. If you are not compressing at all, it is the 2 MB wire cap, and gzip alone fixes it. The map is also parsed under limits (2,000,000 mapping segments, 50,000 sources, 500,000 names, a parse time and memory cap): a map over a count limit returns 413 and one that exhausts the parse time or memory returns 422, each naming the limit. A 400 means the body was missing one of release, url, map; or the map did not parse; or release / url was empty or absurdly long (the caps are 200 and 2,000 characters).

Branch B: upload accepted, frames still minified. This is the common one, and the four constraints above are the diagnostic sequence, in order. (1) Compare the url in the listing against the URL in the actual stack frame. A mismatch here explains most cases, and it is usually a build path where a CDN URL should be. (2) Compare the error's service.version against the release in the listing, exact string. If the stack says no source map for this release, this is the mismatch. (3) If frames resolve to the wrong place rather than not at all, suspect the 1-based line / 0-based column convention, or two different bundles uploaded at the same URL in one release. (4) If some frames resolve and others do not, that is probably correct behavior: vendor and framework bundles ship no maps and are meant to pass through. Confirm with the resolved count from a direct resolve call.

Source maps have a per-tenant budget of 2 GiB of stored gzip bytes and a separate 20,000-map abuse limit by default. Uploads evict the oldest eligible releases whole until both limits are met. A release is protected for 24 hours after its newest upload, and the release being uploaded is always protected. If those protections leave insufficient room, the upload returns 429 with a quota message; a single map larger than the byte budget returns 413. Check CI upload responses and honor Retry-After when present: quota responses give the next eligible release time, and busy uploads request a brief retry. If the current release alone fills the budget, upload smaller maps or fewer bundles. Older evicted releases no longer symbolicate. Self-hosters can set EPOK_SOURCEMAP_MAX_BYTES_PER_TENANT and EPOK_SOURCEMAP_MAX_ROWS_PER_TENANT to adjust the limits.

What you do not need

  • No bundler plugin. There is nothing to install into webpack, Vite, Rollup, or esbuild. It is an HTTP POST from a shell script, so it works identically in any CI, and you can read exactly what it does.
  • No public map hosting. You do not have to deploy .js.map files next to your bundles or leave a sourceMappingURL pointing at them. Upload from CI and keep the maps off your CDN.

Next

  • Browser RUM & session replay: the guide this one completes. Get errors reporting first, then symbolicate them.
  • Traces (APM): the backend half. A frontend error and the backend span that caused it share a trace id.
  • Authentication: which credential schemes each plane accepts, and 401 triage.
  • API reference: the rest of the app-plane endpoints.