glitchgrab 1.68.0 → 1.68.2
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 +59 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +249 -269
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -269
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +63 -2
- package/dist/server.d.ts +63 -2
- package/dist/server.js +234 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +232 -1
- package/dist/server.mjs.map +1 -1
- package/dist/{types-Dw587jLi.d.mts → types-CN-BjNB6.d.mts} +14 -1
- package/dist/{types-Dw587jLi.d.ts → types-CN-BjNB6.d.ts} +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -884,6 +884,31 @@ hydrateRoot(document, <App />, {
|
|
|
884
884
|
|
|
885
885
|
Next.js does not expose `hydrateRoot` options, so App Router apps should use the `error.tsx` snippets above.
|
|
886
886
|
|
|
887
|
+
### Console lines and slow requests (browser)
|
|
888
|
+
|
|
889
|
+
On by default — nothing to add. In production the provider files:
|
|
890
|
+
|
|
891
|
+
- every distinct `console.error` / `console.warn` line, and
|
|
892
|
+
- every same-origin request slower than 10 seconds (a `PERFORMANCE` issue,
|
|
893
|
+
labelled `gg:performance`).
|
|
894
|
+
|
|
895
|
+
```tsx
|
|
896
|
+
<GlitchgrabProvider
|
|
897
|
+
token={token}
|
|
898
|
+
captureConsole={["error"]} // only errors; false turns console capture off
|
|
899
|
+
slowRequestMs={20000} // a different threshold; 0 turns it off
|
|
900
|
+
>
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
- Production only. A dev server prints hundreds of warnings a minute.
|
|
904
|
+
- One issue per message, and one per endpoint for slow requests (ids folded to
|
|
905
|
+
`[id]`, so `/api/users/42` and `/api/users/97` are one issue). Later repeats
|
|
906
|
+
are added to the open issue as comments. At most 10 such reports per page load.
|
|
907
|
+
- Tokens, emails and URL passwords are scrubbed from the line before it is sent.
|
|
908
|
+
- Third-party calls are ignored. An error React logs and your `error.tsx` then
|
|
909
|
+
files with `captureError` is filed once.
|
|
910
|
+
- `ignoreErrors` silences a noisy line. Needs `breadcrumbs` on (the default).
|
|
911
|
+
|
|
887
912
|
### Hydration errors (React #418 family)
|
|
888
913
|
|
|
889
914
|
Nothing to wire. In production the provider catches React #418/#419/#422/#423/#425 with the **component stack** React built for them (Next.js normally throws it away), the server HTML React replaced, any extension or Translate nodes found in the page, and fetch timing. The issue is labelled `gg:hydration` and its title names the element that mismatched. The same mismatch groups into one issue across pages, browsers and deploys. If your site serves source maps (`productionBrowserSourceMaps: true`), Glitchgrab also maps the stack to your source files, so the issue names the nearest component file too.
|
|
@@ -1000,6 +1025,40 @@ export function register() {
|
|
|
1000
1025
|
without taking over — your process still crashes exactly as it would have. A
|
|
1001
1026
|
reporter that keeps a broken process alive is worse than no reporter.
|
|
1002
1027
|
|
|
1028
|
+
### Errors Next.js catches in routes, pages and server actions
|
|
1029
|
+
|
|
1030
|
+
Next.js catches these itself and only prints them, so `captureServerErrors()`
|
|
1031
|
+
never sees them. Hand them over from `onRequestError`:
|
|
1032
|
+
|
|
1033
|
+
```ts
|
|
1034
|
+
// instrumentation.ts
|
|
1035
|
+
export async function register() {
|
|
1036
|
+
if (process.env.NEXT_RUNTIME !== "nodejs") return;
|
|
1037
|
+
const { captureServerErrors } = await import("glitchgrab/server");
|
|
1038
|
+
// Crashes, unhandled rejections AND console.error / console.warn lines.
|
|
1039
|
+
captureServerErrors();
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export async function onRequestError(
|
|
1043
|
+
...args: Parameters<typeof import("glitchgrab/server").reportRequestError>
|
|
1044
|
+
) {
|
|
1045
|
+
if (process.env.NEXT_RUNTIME !== "nodejs") return;
|
|
1046
|
+
const { reportRequestError } = await import("glitchgrab/server");
|
|
1047
|
+
await reportRequestError(...args);
|
|
1048
|
+
}
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
- One issue per route **file** (`/app/api/users/[id]/route`), not per URL.
|
|
1052
|
+
- Client hang-ups (`Error: aborted`, `ECONNRESET`) are never filed: the browser
|
|
1053
|
+
closed the request, nothing broke.
|
|
1054
|
+
- An error that both `onRequestError` and `console.error` see is filed once.
|
|
1055
|
+
- `captureServerErrors()` files console errors and warnings by default:
|
|
1056
|
+
`captureServerErrors({ console: ["error"] })` for errors only, `console: false`
|
|
1057
|
+
to turn it off. For an `ignore: [/pattern/]` list, set `console: false` and
|
|
1058
|
+
call `captureServerConsole({ levels, ignore })` yourself. Repeats of one line
|
|
1059
|
+
land on one issue; tokens, emails and URL passwords are scrubbed first.
|
|
1060
|
+
- Production only, like everything else here, unless `enableInDevelopment: true`.
|
|
1061
|
+
|
|
1003
1062
|
### `context` is the grouping key
|
|
1004
1063
|
|
|
1005
1064
|
It is sent as the report's `pageUrl` (as `server://<context>`), and `pageUrl`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-
|
|
3
|
-
export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-
|
|
2
|
+
import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-CN-BjNB6.mjs';
|
|
3
|
+
export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-CN-BjNB6.mjs';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-
|
|
3
|
-
export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-
|
|
2
|
+
import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-CN-BjNB6.js';
|
|
3
|
+
export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-CN-BjNB6.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|