@dasasian/firebase-structured-logger 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +598 -102
- package/dist/functions/httpHandler.d.ts +89 -0
- package/dist/functions/httpHandler.d.ts.map +1 -0
- package/dist/functions/httpHandler.js +112 -0
- package/dist/functions/httpHandler.js.map +1 -0
- package/dist/functions/index.d.ts +5 -2
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +6 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/logHandler.d.ts +53 -2
- package/dist/functions/logHandler.d.ts.map +1 -1
- package/dist/functions/logHandler.js +38 -7
- package/dist/functions/logHandler.js.map +1 -1
- package/dist/functions/logger.d.ts.map +1 -1
- package/dist/functions/logger.js +54 -3
- package/dist/functions/logger.js.map +1 -1
- package/dist/functions/sourceMapCache.d.ts +27 -1
- package/dist/functions/sourceMapCache.d.ts.map +1 -1
- package/dist/functions/sourceMapCache.js +84 -9
- package/dist/functions/sourceMapCache.js.map +1 -1
- package/dist/functions/traceContext.d.ts +40 -0
- package/dist/functions/traceContext.d.ts.map +1 -0
- package/dist/functions/traceContext.js +93 -0
- package/dist/functions/traceContext.js.map +1 -0
- package/dist/shared/paths.d.ts +59 -0
- package/dist/shared/paths.d.ts.map +1 -0
- package/dist/shared/paths.js +126 -0
- package/dist/shared/paths.js.map +1 -0
- package/dist/tools/index.js +13 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/uploadSourceMaps.d.ts +24 -1
- package/dist/tools/uploadSourceMaps.d.ts.map +1 -1
- package/dist/tools/uploadSourceMaps.js +31 -4
- package/dist/tools/uploadSourceMaps.js.map +1 -1
- package/package.json +3 -3
- package/skills/query-logs/SKILL.md +14 -1
|
@@ -17,11 +17,34 @@ export declare const EXIT_UPLOAD_FAILED_BUT_EMBEDDED = 3;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const EMBEDDED_RELEASE_MARKER = ".release";
|
|
19
19
|
export interface UploadOptions {
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Cloud Storage bucket to upload to. Resolved by the caller — the CLI falls
|
|
22
|
+
* back to env vars.
|
|
23
|
+
*
|
|
24
|
+
* Optional, but only alongside `embedSourcemaps`: a run that neither uploads
|
|
25
|
+
* nor embeds does nothing except delete maps, which is not a thing to let
|
|
26
|
+
* someone ask for by accident. Omitting it is how a backend with no bucket —
|
|
27
|
+
* Cloud Run, say — gets the embedded copy without inventing a bucket name to
|
|
28
|
+
* satisfy the tool (#34).
|
|
29
|
+
*/
|
|
30
|
+
bucket?: string;
|
|
21
31
|
release?: string;
|
|
22
32
|
distDir?: string;
|
|
23
33
|
functionsDir?: string;
|
|
24
34
|
embedSourcemaps?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Cloud Storage prefix to upload under. Defaults to `sourcemaps/`.
|
|
37
|
+
*
|
|
38
|
+
* The reader must be told the same value, via
|
|
39
|
+
* `createClientLogHandler({ sourceMaps: { prefix } })`. These are the two ends
|
|
40
|
+
* of one contract and nothing checks them against each other — when they
|
|
41
|
+
* disagree the maps are simply not found and stacks stay minified, which
|
|
42
|
+
* looks identical to never having uploaded them (#35).
|
|
43
|
+
*
|
|
44
|
+
* Does not affect the embedded copy: that directory ships inside the deploy
|
|
45
|
+
* artifact and nothing outside reads it, so it stays fixed.
|
|
46
|
+
*/
|
|
47
|
+
prefix?: string;
|
|
25
48
|
}
|
|
26
49
|
/**
|
|
27
50
|
* Drop `sourcesContent` from a source map, returning the JSON to store.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadSourceMaps.d.ts","sourceRoot":"","sources":["../../src/tools/uploadSourceMaps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uploadSourceMaps.d.ts","sourceRoot":"","sources":["../../src/tools/uploadSourceMaps.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,aAAiB,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CASpF;AA8BD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAkH7F"}
|
|
@@ -39,6 +39,7 @@ exports.uploadSourceMaps = uploadSourceMaps;
|
|
|
39
39
|
const fs = __importStar(require("fs"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const storage_1 = require("@google-cloud/storage");
|
|
42
|
+
const paths_js_1 = require("../shared/paths.js");
|
|
42
43
|
/**
|
|
43
44
|
* Exit code used when maps were embedded but the Storage upload failed.
|
|
44
45
|
*
|
|
@@ -56,7 +57,7 @@ exports.EXIT_UPLOAD_FAILED_BUT_EMBEDDED = 3;
|
|
|
56
57
|
* by filename, so an old stack naming a bundle that still exists would be
|
|
57
58
|
* resolved with the current map, giving confidently wrong line numbers.
|
|
58
59
|
*/
|
|
59
|
-
exports.EMBEDDED_RELEASE_MARKER =
|
|
60
|
+
exports.EMBEDDED_RELEASE_MARKER = paths_js_1.RELEASE_MARKER;
|
|
60
61
|
/**
|
|
61
62
|
* Drop `sourcesContent` from a source map, returning the JSON to store.
|
|
62
63
|
*
|
|
@@ -118,14 +119,19 @@ async function uploadSourceMaps(options) {
|
|
|
118
119
|
}
|
|
119
120
|
const distDir = options.distDir ?? path.join(process.cwd(), 'dist');
|
|
120
121
|
const mapFiles = findMapFiles(distDir);
|
|
122
|
+
if (!options.bucket && !options.embedSourcemaps) {
|
|
123
|
+
throw new Error('[fsl] Nothing to do: no --bucket to upload to and no --embed-sourcemaps. ' +
|
|
124
|
+
'Running would only delete the maps from dist/.');
|
|
125
|
+
}
|
|
121
126
|
if (mapFiles.length === 0) {
|
|
122
127
|
console.log('[fsl] No .map files found in', distDir);
|
|
123
128
|
return { uploaded: true };
|
|
124
129
|
}
|
|
125
|
-
|
|
130
|
+
const verb = options.bucket ? 'Uploading' : 'Embedding';
|
|
131
|
+
console.log(`[fsl] ${verb} ${mapFiles.length} source map(s) for release ${releaseId}...`);
|
|
126
132
|
// Embed maps into functions directory before uploading (for fast lookup of current release)
|
|
127
133
|
if (options.embedSourcemaps && options.functionsDir) {
|
|
128
|
-
const embedDir = path.join(process.cwd(), options.functionsDir
|
|
134
|
+
const embedDir = (0, paths_js_1.embeddedDir)(path.join(process.cwd(), options.functionsDir));
|
|
129
135
|
fs.mkdirSync(embedDir, { recursive: true });
|
|
130
136
|
for (const f of fs.readdirSync(embedDir)) {
|
|
131
137
|
fs.unlinkSync(path.join(embedDir, f));
|
|
@@ -139,6 +145,27 @@ async function uploadSourceMaps(options) {
|
|
|
139
145
|
const saved = before > after ? ` (${kb(before)} → ${kb(after)})` : '';
|
|
140
146
|
console.log(` ✓ embedded ${path.basename(localPath)} → ${options.functionsDir}/sourcemaps/current/${saved}`);
|
|
141
147
|
}
|
|
148
|
+
// Record which release these maps are for. Without it the runtime cannot tell
|
|
149
|
+
// a stack from the deployed release from a stack from an older one, and
|
|
150
|
+
// resolves both with whatever is embedded — see the marker's own doc above.
|
|
151
|
+
// Written after the loop, which has already cleared any stale marker.
|
|
152
|
+
fs.writeFileSync(path.join(embedDir, paths_js_1.RELEASE_MARKER), releaseId);
|
|
153
|
+
console.log(` ✓ marked ${options.functionsDir}/sourcemaps/current/ as release ${releaseId}`);
|
|
154
|
+
}
|
|
155
|
+
// Embed-only: nothing to authenticate against, so do not construct a client.
|
|
156
|
+
// The maps still leave dist/ — they are embedded, and leaving them behind
|
|
157
|
+
// would serve source maps to browsers, which is the worse outcome.
|
|
158
|
+
if (!options.bucket) {
|
|
159
|
+
for (const localPath of mapFiles) {
|
|
160
|
+
if (fs.existsSync(localPath)) {
|
|
161
|
+
fs.unlinkSync(localPath);
|
|
162
|
+
console.log(` ✗ deleted ${path.relative(process.cwd(), localPath)}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
console.log('[fsl] Embedded only — no bucket given, nothing uploaded.');
|
|
166
|
+
console.log(`[fsl] Stacks from ${releaseId} symbolicate while it is the deployed release.`);
|
|
167
|
+
console.log('[fsl] Older releases cannot be symbolicated without a bucket to read from.');
|
|
168
|
+
return { uploaded: true };
|
|
142
169
|
}
|
|
143
170
|
// Authenticate via service account key if available, otherwise fall back to ADC
|
|
144
171
|
const serviceAccountPath = process.env.FIREBASE_SERVICE_ACCOUNT_PATH;
|
|
@@ -150,7 +177,7 @@ async function uploadSourceMaps(options) {
|
|
|
150
177
|
try {
|
|
151
178
|
for (const localPath of mapFiles) {
|
|
152
179
|
const fileName = path.basename(localPath);
|
|
153
|
-
const destination =
|
|
180
|
+
const destination = (0, paths_js_1.storageMapPath)(releaseId, (0, paths_js_1.bundleNameOf)(fileName), options.prefix);
|
|
154
181
|
const { json, before, after } = readStrippedMap(localPath);
|
|
155
182
|
await bucket.file(destination).save(json, { contentType: 'application/json' });
|
|
156
183
|
const saved = before > after ? ` (${kb(before)} → ${kb(after)}, -${Math.round(100 - (after / before) * 100)}%)` : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadSourceMaps.js","sourceRoot":"","sources":["../../src/tools/uploadSourceMaps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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CAAC,eAAe,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,CAAA;YACvE,CAAC;QACH,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC5B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dasasian/firebase-structured-logger",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Structured logging for Firebase apps — client, functions, and tools",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dasasian",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"build": "tsc",
|
|
65
65
|
"build:watch": "tsc --watch",
|
|
66
66
|
"clean": "rm -rf dist",
|
|
67
|
-
"typecheck": "tsc --noEmit",
|
|
68
|
-
"test": "tsx tests/logger.ts && tsx tests/breadcrumbs.ts && tsx tests/rateLimiter.ts && tsx tests/errorHandler.ts && tsx tests/attachments.ts && tsx tests/feedback.ts && tsx tests/sourceMapStripping.ts && FUNCTIONS_EMULATOR=true tsx tests/errorPayload.ts && FUNCTIONS_EMULATOR=true tsx tests/requestLogger.ts && FUNCTIONS_EMULATOR=true tsx tests/handler.ts && FUNCTIONS_EMULATOR=true tsx tests/symbolication.ts && FUNCTIONS_EMULATOR=true tsx tests/publicApi.ts && FUNCTIONS_EMULATOR=true tsx tests/configureTwice.ts && tsx tests/productionOutput.ts && tsx tests/handlerSymbolication.ts && tsx tests/releaseResolution.ts && tsx tests/sourceMapCacheBounds.ts",
|
|
67
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.check.json",
|
|
68
|
+
"test": "tsx tests/logger.ts && tsx tests/breadcrumbs.ts && tsx tests/rateLimiter.ts && tsx tests/errorHandler.ts && tsx tests/attachments.ts && tsx tests/feedback.ts && tsx tests/paths.ts && tsx tests/sourceMapStripping.ts && FUNCTIONS_EMULATOR=true tsx tests/errorPayload.ts && FUNCTIONS_EMULATOR=true tsx tests/requestLogger.ts && FUNCTIONS_EMULATOR=true tsx tests/handler.ts && FUNCTIONS_EMULATOR=true tsx tests/httpHandler.ts && FUNCTIONS_EMULATOR=true tsx tests/symbolication.ts && FUNCTIONS_EMULATOR=true tsx tests/publicApi.ts && FUNCTIONS_EMULATOR=true tsx tests/configureTwice.ts && tsx tests/productionOutput.ts && tsx tests/handlerSymbolication.ts && tsx tests/releaseResolution.ts && tsx tests/sourceMapCacheBounds.ts",
|
|
69
69
|
"prepublishOnly": "npm run clean && npm run build",
|
|
70
70
|
"smoke:deploy": "cd smoke/functions && npm install && npm run build && cd .. && firebase deploy --only functions --project $(grep '^FSL_SMOKE_PROJECT=' .env.local | cut -d= -f2)",
|
|
71
71
|
"smoke": "tsx smoke/run.ts"
|
|
@@ -30,7 +30,20 @@ App-specific labels are defined in each app's `AppLabels` type.
|
|
|
30
30
|
|
|
31
31
|
## Common Queries
|
|
32
32
|
|
|
33
|
-
###
|
|
33
|
+
### Everything one user did, in order
|
|
34
|
+
```
|
|
35
|
+
labels.userId="<uid>"
|
|
36
|
+
```
|
|
37
|
+
No severity filter. Frontend and backend entries share the `userId` label, so this
|
|
38
|
+
returns both halves interleaved in time order — the clicks and screen changes that
|
|
39
|
+
led up to a failure, the backend call that failed, and the error the browser saw.
|
|
40
|
+
Filtering to `severity=ERROR` keeps the crash and throws away the story; reach for
|
|
41
|
+
it only when you already know what you are looking for.
|
|
42
|
+
|
|
43
|
+
Add `labels.platform:*` for client entries only, or `labels.functionName:*` for
|
|
44
|
+
server entries only.
|
|
45
|
+
|
|
46
|
+
### Only the errors for a user
|
|
34
47
|
```
|
|
35
48
|
labels.userId="<uid>" severity=ERROR
|
|
36
49
|
```
|