@kenkaiiii/error-mom 0.3.3 → 0.3.4
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 +112 -5
- package/dist/{chunk-UNG24UNX.js → chunk-ISLSQ4VJ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,124 @@
|
|
|
1
1
|
# @kenkaiiii/error-mom
|
|
2
2
|
|
|
3
|
-
Automatic browser and Node.js error capture for a self-hosted Error Mom deployment.
|
|
3
|
+
Automatic browser and Node.js error capture for a self-hosted [Error Mom](https://github.com/KenKaiii/error-mom) deployment.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kenkaiiii/error-mom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create a project and generate framework-specific setup with the Error Mom CLI:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --global error-mom
|
|
15
|
+
error-mom login https://errors.example.com --token "$ERROR_MOM_ADMIN_TOKEN"
|
|
16
|
+
error-mom init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`error-mom init` detects your framework and prints the exact wiring step for its official error hook. The generated project key is write-only and safe to ship; the admin token must stay private.
|
|
20
|
+
|
|
21
|
+
## Browser setup
|
|
4
22
|
|
|
5
23
|
```ts
|
|
6
24
|
import { initErrorMom } from "@kenkaiiii/error-mom";
|
|
7
25
|
|
|
8
|
-
initErrorMom({
|
|
26
|
+
export const errorMom = initErrorMom({
|
|
9
27
|
server: "https://errors.example.com",
|
|
10
28
|
projectKey: "em_ingest_...",
|
|
11
|
-
|
|
29
|
+
environment: import.meta.env.MODE,
|
|
30
|
+
release: import.meta.env.VITE_APP_VERSION,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The browser entry point captures uncaught errors, unhandled rejections, `console.error`, failed requests, and up to 50 preceding breadcrumbs. Failed sends queue in local storage and retry without blocking the app.
|
|
35
|
+
|
|
36
|
+
## Node.js setup
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { initErrorMom } from "@kenkaiiii/error-mom/node";
|
|
40
|
+
|
|
41
|
+
export const errorMom = initErrorMom({
|
|
42
|
+
server: process.env.ERROR_MOM_SERVER!,
|
|
43
|
+
projectKey: process.env.ERROR_MOM_PROJECT_KEY!,
|
|
44
|
+
environment: process.env.NODE_ENV,
|
|
45
|
+
release: process.env.APP_VERSION,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The Node entry point captures uncaught errors, unhandled rejections, `console.error`, and failed requests. Events are written to a private JSONL spool under `~/.error-mom/spool` before upload so an outage or restart does not discard them.
|
|
50
|
+
|
|
51
|
+
Initialize the SDK separately in every process: browser UI, Electron main process, workers, sidecars, and server processes.
|
|
52
|
+
|
|
53
|
+
## Capture handled errors
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
try {
|
|
57
|
+
await exportVideo();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
errorMom.captureError(error, {
|
|
60
|
+
culprit: "video.export",
|
|
61
|
+
tags: { job: "render" },
|
|
62
|
+
context: { videoId },
|
|
63
|
+
});
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Wrap handlers that are caught by a framework, queue, webhook runner, or MCP host:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
export const handler = errorMom.wrap(runJob, {
|
|
72
|
+
culprit: "jobs.render-video",
|
|
12
73
|
});
|
|
13
74
|
```
|
|
14
75
|
|
|
15
|
-
|
|
76
|
+
Add application breadcrumbs when they help explain a later failure:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
errorMom.addBreadcrumb({
|
|
80
|
+
category: "checkout",
|
|
81
|
+
level: "info",
|
|
82
|
+
message: "Payment submitted",
|
|
83
|
+
data: { provider: "stripe" },
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use `await errorMom.flush()` before a controlled shutdown. Call `dispose()` during teardown to restore patched global handlers.
|
|
88
|
+
|
|
89
|
+
## Options
|
|
90
|
+
|
|
91
|
+
| Option | Required | Description |
|
|
92
|
+
| ----------------------- | --------- | -------------------------------------------------------------------- |
|
|
93
|
+
| `server` | yes | Base URL of your Error Mom deployment. |
|
|
94
|
+
| `projectKey` | yes | Write-only project ingest key. Safe to include in shipped clients. |
|
|
95
|
+
| `environment` | no | Deployment environment; defaults to `production`. |
|
|
96
|
+
| `release` | no | App version used for regression detection and source maps. |
|
|
97
|
+
| `tags` | no | String tags attached to every event. |
|
|
98
|
+
| `installationId` | no | Optional anonymous installation identifier. Only its hash is stored. |
|
|
99
|
+
| `captureConsoleErrors` | no | Capture `console.error`; defaults to `true`. |
|
|
100
|
+
| `captureFailedRequests` | no | Capture failed requests; defaults to `true`. |
|
|
101
|
+
| `flushIntervalMs` | no | Retry interval; defaults to 5 seconds. |
|
|
102
|
+
| `maxQueueSize` | no | Browser default: 100. Node default: 1,000. |
|
|
103
|
+
| `spoolDirectory` | Node only | Override the Node JSONL spool directory. |
|
|
104
|
+
|
|
105
|
+
## Automatic request capture
|
|
106
|
+
|
|
107
|
+
Network failures and HTTP 5xx responses are captured automatically. Errors from known AI providers are named and tagged by provider; provider 4xx responses are captured as well.
|
|
108
|
+
|
|
109
|
+
## Privacy and safety
|
|
110
|
+
|
|
111
|
+
Capture and upload failures never throw into the host application. Before sending, the SDK recursively scrubs secret-keyed fields, emails, query credentials, URL userinfo, Telegram bot tokens, Discord and Slack webhook credentials, and explicitly labeled credential path segments such as `/token/<value>` and `/api-key/<value>`. The collector repeats redaction before persistence.
|
|
112
|
+
|
|
113
|
+
## Source maps and verification
|
|
114
|
+
|
|
115
|
+
For minified production builds, report a `release`, enable source maps, and upload them after the build:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
error-mom sourcemaps <build-directory> --release <app-version> --project <project-slug>
|
|
119
|
+
error-mom doctor --symbolication
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Source-map upload requires the private admin token. Ingest keys cannot upload or read data.
|
|
16
123
|
|
|
17
|
-
See the repository README for framework setup,
|
|
124
|
+
See the [repository README](https://github.com/KenKaiii/error-mom#readme) for deployment, framework setup, dashboard, CLI, and MCP instructions.
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
redactStringCredentials
|
|
4
4
|
} from "@kenkaiiii/error-mom-protocol";
|
|
5
5
|
var SDK_NAME = "@kenkaiiii/error-mom";
|
|
6
|
-
var SDK_VERSION = "0.3.
|
|
6
|
+
var SDK_VERSION = "0.3.4";
|
|
7
7
|
var MAX_BREADCRUMBS = 50;
|
|
8
8
|
var SECRET_KEY = /authorization|cookie|password|passwd|secret|token|api[-_]?key|session/i;
|
|
9
9
|
function wrapFunction(capture, fn, context) {
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
27
27
|
// src/shared.ts
|
|
28
28
|
var import_error_mom_protocol = require("@kenkaiiii/error-mom-protocol");
|
|
29
29
|
var SDK_NAME = "@kenkaiiii/error-mom";
|
|
30
|
-
var SDK_VERSION = "0.3.
|
|
30
|
+
var SDK_VERSION = "0.3.4";
|
|
31
31
|
var MAX_BREADCRUMBS = 50;
|
|
32
32
|
var SECRET_KEY = /authorization|cookie|password|passwd|secret|token|api[-_]?key|session/i;
|
|
33
33
|
function wrapFunction(capture, fn, context) {
|
package/dist/index.js
CHANGED
package/dist/node.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var import_node_path = require("path");
|
|
|
32
32
|
// src/shared.ts
|
|
33
33
|
var import_error_mom_protocol = require("@kenkaiiii/error-mom-protocol");
|
|
34
34
|
var SDK_NAME = "@kenkaiiii/error-mom";
|
|
35
|
-
var SDK_VERSION = "0.3.
|
|
35
|
+
var SDK_VERSION = "0.3.4";
|
|
36
36
|
var MAX_BREADCRUMBS = 50;
|
|
37
37
|
var SECRET_KEY = /authorization|cookie|password|passwd|secret|token|api[-_]?key|session/i;
|
|
38
38
|
function wrapFunction(capture, fn, context) {
|
package/dist/node.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenkaiiii/error-mom",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Automatic browser and Node.js error capture for self-hosted Error Mom",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@kenkaiiii/error-mom-protocol": "0.1.
|
|
25
|
+
"@kenkaiiii/error-mom-protocol": "0.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsup": "^8.5.1",
|