Repository navigation
Description
Severity: P2 · Area: Source maps · Found by: QA
Summary
The published @telemetry-tracker/[email protected] builds bundle_url by removing .map from the map's own path. It never reads the chunk's sourceMappingURL. When a map's filename or folder doesn't mirror its chunk, the plugin still reports success, but it uploads the map under a URL that no browser frame will ever have, so those errors don't symbolicate.
The repo source (develop/main) and docs/source-maps.md describe sourceMappingURL resolution. That code is unreleased under the same version number, 1.0.0.
Default Vite output ([name]-[hash].js + [name]-[hash].js.map, including build.sourcemap: 'hidden') works correctly.
Severity reason: P2. Source maps are a headline feature, and the failure is silent: the build log says "Uploaded 2 source maps", but symbolication fails for any non-default map naming or location. The default layout works.
Affected published versions
@telemetry-tracker/[email protected](only version,latest), published 2026-07-10 00:51 CEST. The npm metadata has nogitHead.
Environment and versions
2026-09-26 10:48 CEST. Vite 7.3.6, Node 20.19.2, Linux. Local mock upload server. No real upload.
Steps to reproduce
npm create vite@latest sm -- --template vanilla && cd sm && npm i -D @telemetry-tracker/[email protected], then add a dynamicimport()so there are 2 chunks.- Mock upload server:
// mock.mjs import http from "node:http"; http.createServer((req, res) => { let b = ""; req.on("data", c => b += c); req.on("end", () => { const j = JSON.parse(b); console.log(req.method, req.url, j.bundle_url, "map.file=" + j.content.file); res.writeHead(201).end("{}"); }); }).listen(4318);
vite.config.js: the map hash is independent of the chunk hash (Turbopack-like layout):import { defineConfig } from "vite"; import { telemetrySourceMaps } from "@telemetry-tracker/vite-plugin"; export default defineConfig({ build: { sourcemap: true, rollupOptions: { output: { sourcemapFileNames: "assets/[name]-[hash].js.map" } } }, plugins: [telemetrySourceMaps({ apiKey: "k", projectId: "00000000-0000-4000-8000-000000000001", release: "r1", app: "web", baseUrl: "https://cdn.example.test", baseApiUrl: "http://127.0.0.1:4318" })], });
npx vite build, then compare each loggedbundle_urlwith the chunk that references the map.
Expected
bundle_url is the URL of the chunk whose sourceMappingURL points at the map, e.g. https://cdn.example.test/assets/index-azjItrWU.js. That's what docs/source-maps.md line 149 promises ("The plugin and GitHub Action set bundle_url from the built file's sourceMappingURL comment…").
Actual
Same app, 5 layouts, published plugin vs. a build of the repo develop source (packages/telemetry-vite-plugin, 1.0.0 @ c652e61):
| Layout | Maps | npm 1.0.0: uploaded / correct bundle_url |
repo develop: uploaded / correct |
|---|---|---|---|
default (sourcemap: true, hashed *.js.map beside chunk) |
2 | 2 / 2 | 2 / 2 |
sourcemap: 'hidden' (no comment) |
2 | 2 / 2 | 2 / 2 |
map hash ≠ chunk hash (assets/index-J4e2xGyD.js.map for assets/index-azjItrWU.js) |
2 | 2 / 0: sent …/assets/index-J4e2xGyD.js |
2 / 2 |
maps moved to maps/, comment ../maps/index-azjItrWU.js.map |
2 | 2 / 0: sent …/maps/index-azjItrWU.js |
2 / 2 |
sourcemapFileNames: "maps/[name]-[hash].map" |
2 | 2 / 0: sent …/maps/index-J4e2xGyD |
2 / 0 (Vite writes a comment that doesn't resolve to the map; not a plugin bug) |
map named *.map.json |
2 | 0 uploaded (only *.map is scanned) |
0 uploaded |
- Request shape (identical in both builds):
POST <baseApiUrl>/api/project/source-maps, headerscontent-type,x-project-id,x-api-key, body{app, release, bundle_url, content}. - In every case the build exits 0 and logs "Uploaded 2 source maps."
Root cause
- npm
dist/upload.js:21-38bundleUrlForMapFile()doesrelativePath.replace(/\.map$/, "")on the map path (line 27).dist/upload.js:66passes the map path directly. There's nosourceMappingURLparsing anywhere in the dist.findMapFilesonly matches*.map(line 46). - The npm dist is byte-identical to
tscoutput of the repo at74cb41d(2026-07-09 21:29 CEST, the last plugin commit before the publish). - repo
develop/mainpackages/telemetry-vite-plugin/src/upload.ts:parseSourceMappingURL(56),bundleFileForSourceMap(69),findBundleSources(110), and the call at 158-159. Added in0e9158e(PR Scope source map uploads and flush fatal Node errors #672, 2026-09-25) without a version bump (package.json still 1.0.0). Built from develop, onlyupload.jsdiffers from npm (54 changed lines).index.jsis identical.
Release coordination
Single package, no dependency on core/node: publish @telemetry-tracker/[email protected] (new exported helpers parseSourceMappingURL, bundleFileForSourceMap, findBundleSources, so minor) from develop, with gitHead recorded. It's independent of the core/node release in #711. The GitHub Action already has the equivalent logic on main and tags ≥ v1.17.18.
Acceptance criteria
With the newly published @telemetry-tracker/vite-plugin@latest and the config above:
- every
bundle_urlequals the URL of the chunk whosesourceMappingURLresolves to the uploaded map (independent-hash and moved-maps layouts: 2/2 correct); - default and
hiddenlayouts are unchanged (2/2 correct); npm view @telemetry-tracker/vite-plugin@<new> gitHeadmatches the tagged commit;- the npm tarball's
dist/upload.jscontainsparseSourceMappingURL.
Fix references
- Unreleased repo fix:
0e9158e(PR Scope source map uploads and flush fatal Node errors #672). Needs an npm release.
History
- 2026-09-26 10:48 CEST: found and reproduced (6 layouts, npm vs. repo build).
Filed from the QA regression list on 2026-09-26. Source: QA report 2026-09-26-sdk-qa.md (#tt-018).
Activity
fix(sdk): harden fatal throws and publish guards for #722
fix(sdk): prepare core 1.5 / node 1.4 / vite-plugin 1.1
unjica commentedon Oct 2, 2026
QA verification — PASS (closed)
When: 2026-10-02 ~08:58 CEST (weekday smoke)
Fix: PR #722 → published
@telemetry-tracker/[email protected]Method: Fresh registry install; exercised
parseSourceMappingURL/bundleFileForSourceMapfrom the publisheddist/upload.jstwice.sourceMappingURL=../maps/index-BBB.js.map) resolves to the real chunkindex-AAA.jsBoth layouts 2/2. Closing as verified-fixed on vite-plugin 1.1.0.