@autter/runtime-next 1.6.0 → 1.6.1

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 CHANGED
@@ -9,8 +9,8 @@ same-origin relay route, and a React error boundary.
9
9
  npm install @autter/runtime-next
10
10
  ```
11
11
 
12
- Set `AUTTER_RUNTIME_KEY` in your environment. Then one line of
13
- `next.config` and three small files.
12
+ Set `AUTTER_RUNTIME_KEY` in your environment. Then three small files, and
13
+ (recommended) one line of `next.config`.
14
14
 
15
15
  The package has two entry points — this split is what keeps the Node
16
16
  OpenTelemetry SDK out of your browser bundle:
@@ -22,8 +22,8 @@ OpenTelemetry SDK out of your browser bundle:
22
22
  - `@autter/runtime-next/instrumentation` — `onRequestError` for
23
23
  `instrumentation.ts`; safe on both the Node and edge runtimes.
24
24
 
25
- **`next.config`** — one copy of the Node SDK for `instrumentation.ts` and
26
- your routes:
25
+ **`next.config`** (recommended) — load the Node SDK from `node_modules`
26
+ instead of bundling it:
27
27
 
28
28
  ```js
29
29
  // next.config.mjs
@@ -33,12 +33,16 @@ export default {
33
33
  ```
34
34
 
35
35
  Next bundles server dependencies separately into `instrumentation.ts` and
36
- into each route. Without this line, code in routes, server components and
37
- server actions (`withRuntimeRequest`, `captureServerException`,
38
- `runtimeLogger`, `runtimeContext`, …) reaches a copy of the SDK that
39
- `registerAutter` never started: request summaries are printed to the
40
- console instead of being exported, and an error `withRuntimeRequest`
41
- reports is reported a second time by `onRequestError`. Next 14.2:
36
+ into the route bundles. Since 1.6.1 every copy shares the SDK
37
+ `registerAutter` started, so routes, server components and server actions
38
+ (`withRuntimeRequest`, `captureServerException`, `runtimeLogger`,
39
+ `runtimeContext`, …) export through it, and an error `withRuntimeRequest`
40
+ reported is not reported again by `onRequestError`, with or without this
41
+ line. The line keeps the SDK and its OpenTelemetry
42
+ dependencies out of the route bundles: in our Next 15.5 and 16.4 test app
43
+ the server output had 1.1 to 2.3 MB less JavaScript. (1.6.0 needed it:
44
+ without it, request summaries went to the console and errors were reported
45
+ twice.) Next 14.2:
42
46
  `experimental: { serverComponentsExternalPackages: ["@autter/runtime-node"] }`.
43
47
 
44
48
  **1. `instrumentation.ts`** — server tracing/errors:
@@ -141,6 +145,24 @@ export function Providers({ children }: { children: React.ReactNode }) {
141
145
  React render errors don't reach `window.onerror` — the boundary reports
142
146
  them via `captureException` and then renders your fallback.
143
147
 
148
+ **Linking browser errors to server traces** (opt-in): call
149
+ `enableTracePropagation` from `@autter/runtime-next/client`, next to
150
+ `initAutterBrowser` and before the app sends requests. Same-origin `fetch`
151
+ and XHR requests (your route handlers and server actions) then carry a W3C
152
+ `traceparent`, which `registerAutter` continues, so a browser error links to
153
+ the server trace of the request behind it. Cross-origin APIs get one only
154
+ when listed in `tracePropagationTargets`, and must allow the header in CORS.
155
+ `disableTracePropagation()` turns it off; the rules are in
156
+ `@autter/runtime-browser`'s README ("Trace propagation").
157
+
158
+ ```tsx
159
+ "use client";
160
+ import { initAutterBrowser, enableTracePropagation } from "@autter/runtime-next/client";
161
+
162
+ initAutterBrowser({ endpoint: "/api/autter-runtime", service: "web-app" });
163
+ enableTracePropagation({ tracePropagationTargets: ["https://api.example.com/"] });
164
+ ```
165
+
144
166
  Also re-exported for convenience: `captureException`, `captureMessage`,
145
167
  `trackEvent`, `setUser`, `setContext`, `flush` (from
146
168
  `@autter/runtime-next/client`) and `captureServerException`,
@@ -8,7 +8,7 @@ import {
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@autter/runtime-next",
11
- version: "1.6.0",
11
+ version: "1.6.1",
12
12
  description: "One-command Autter Runtime for Next.js: server OTel, request wide events, coded errors, browser tracker, relay route, edge middleware and React error boundary",
13
13
  license: "MIT",
14
14
  type: "module",
@@ -65,7 +65,7 @@ var package_default = {
65
65
  dependencies: {
66
66
  "@autter/runtime-browser": "^1.6.0",
67
67
  "@autter/runtime-edge": "^1.1.0",
68
- "@autter/runtime-node": "^1.6.0"
68
+ "@autter/runtime-node": "^1.6.1"
69
69
  },
70
70
  peerDependencies: {
71
71
  react: ">=18"
package/dist/client.cjs CHANGED
@@ -40,7 +40,9 @@ __export(client_exports, {
40
40
  captureMessage: () => import_runtime_browser2.captureMessage,
41
41
  captureOutcome: () => import_runtime_browser2.captureOutcome,
42
42
  clearBreadcrumbs: () => import_breadcrumbs.clearBreadcrumbs,
43
+ disableTracePropagation: () => import_tracing.disableTracePropagation,
43
44
  enableBreadcrumbs: () => import_breadcrumbs.enableBreadcrumbs,
45
+ enableTracePropagation: () => import_tracing.enableTracePropagation,
44
46
  flush: () => import_runtime_browser2.flush,
45
47
  initAutterBrowser: () => import_runtime_browser2.initAutterBrowser,
46
48
  setContext: () => import_runtime_browser2.setContext,
@@ -50,6 +52,7 @@ __export(client_exports, {
50
52
  module.exports = __toCommonJS(client_exports);
51
53
  var import_runtime_browser2 = require("@autter/runtime-browser");
52
54
  var import_breadcrumbs = require("@autter/runtime-browser/breadcrumbs");
55
+ var import_tracing = require("@autter/runtime-browser/tracing");
53
56
 
54
57
  // src/error-boundary.ts
55
58
  var React = __toESM(require("react"), 1);
@@ -87,7 +90,9 @@ var AutterErrorBoundary = class extends React.Component {
87
90
  captureMessage,
88
91
  captureOutcome,
89
92
  clearBreadcrumbs,
93
+ disableTracePropagation,
90
94
  enableBreadcrumbs,
95
+ enableTracePropagation,
91
96
  flush,
92
97
  initAutterBrowser,
93
98
  setContext,
package/dist/client.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { AutterSeverity, autterErrorFromResponse, captureException, captureMessage, captureOutcome, flush, initAutterBrowser, setContext, setUser, trackEvent } from '@autter/runtime-browser';
2
2
  export { Breadcrumb, BreadcrumbInput, BreadcrumbOptions, addBreadcrumb, clearBreadcrumbs, enableBreadcrumbs } from '@autter/runtime-browser/breadcrumbs';
3
+ export { TracePropagationOptions, disableTracePropagation, enableTracePropagation } from '@autter/runtime-browser/tracing';
3
4
  import * as React from 'react';
4
5
 
5
6
  /**
package/dist/client.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { AutterSeverity, autterErrorFromResponse, captureException, captureMessage, captureOutcome, flush, initAutterBrowser, setContext, setUser, trackEvent } from '@autter/runtime-browser';
2
2
  export { Breadcrumb, BreadcrumbInput, BreadcrumbOptions, addBreadcrumb, clearBreadcrumbs, enableBreadcrumbs } from '@autter/runtime-browser/breadcrumbs';
3
+ export { TracePropagationOptions, disableTracePropagation, enableTracePropagation } from '@autter/runtime-browser/tracing';
3
4
  import * as React from 'react';
4
5
 
5
6
  /**
package/dist/client.js CHANGED
@@ -20,6 +20,10 @@ import {
20
20
  addBreadcrumb,
21
21
  clearBreadcrumbs
22
22
  } from "@autter/runtime-browser/breadcrumbs";
23
+ import {
24
+ enableTracePropagation,
25
+ disableTracePropagation
26
+ } from "@autter/runtime-browser/tracing";
23
27
 
24
28
  // src/error-boundary.ts
25
29
  import * as React from "react";
@@ -56,7 +60,9 @@ export {
56
60
  captureMessage,
57
61
  captureOutcome,
58
62
  clearBreadcrumbs,
63
+ disableTracePropagation,
59
64
  enableBreadcrumbs,
65
+ enableTracePropagation,
60
66
  flush,
61
67
  initAutterBrowser,
62
68
  setContext,
package/dist/index.cjs CHANGED
@@ -73,7 +73,7 @@ var import_runtime_node = require("@autter/runtime-node");
73
73
  // package.json
74
74
  var package_default = {
75
75
  name: "@autter/runtime-next",
76
- version: "1.6.0",
76
+ version: "1.6.1",
77
77
  description: "One-command Autter Runtime for Next.js: server OTel, request wide events, coded errors, browser tracker, relay route, edge middleware and React error boundary",
78
78
  license: "MIT",
79
79
  type: "module",
@@ -130,7 +130,7 @@ var package_default = {
130
130
  dependencies: {
131
131
  "@autter/runtime-browser": "^1.6.0",
132
132
  "@autter/runtime-edge": "^1.1.0",
133
- "@autter/runtime-node": "^1.6.0"
133
+ "@autter/runtime-node": "^1.6.1"
134
134
  },
135
135
  peerDependencies: {
136
136
  react: ">=18"
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  withProcessSpan,
44
44
  withRuntimeOperation,
45
45
  withRuntimeRequest
46
- } from "./chunk-QFEFRAVO.js";
46
+ } from "./chunk-HLKKX6FY.js";
47
47
  export {
48
48
  CODE_PATTERN,
49
49
  RuntimeError,
package/dist/server.cjs CHANGED
@@ -71,7 +71,7 @@ var import_runtime_node = require("@autter/runtime-node");
71
71
  // package.json
72
72
  var package_default = {
73
73
  name: "@autter/runtime-next",
74
- version: "1.6.0",
74
+ version: "1.6.1",
75
75
  description: "One-command Autter Runtime for Next.js: server OTel, request wide events, coded errors, browser tracker, relay route, edge middleware and React error boundary",
76
76
  license: "MIT",
77
77
  type: "module",
@@ -128,7 +128,7 @@ var package_default = {
128
128
  dependencies: {
129
129
  "@autter/runtime-browser": "^1.6.0",
130
130
  "@autter/runtime-edge": "^1.1.0",
131
- "@autter/runtime-node": "^1.6.0"
131
+ "@autter/runtime-node": "^1.6.1"
132
132
  },
133
133
  peerDependencies: {
134
134
  react: ">=18"
package/dist/server.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  withProcessSpan,
44
44
  withRuntimeOperation,
45
45
  withRuntimeRequest
46
- } from "./chunk-QFEFRAVO.js";
46
+ } from "./chunk-HLKKX6FY.js";
47
47
  export {
48
48
  CODE_PATTERN,
49
49
  RuntimeError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autter/runtime-next",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "One-command Autter Runtime for Next.js: server OTel, request wide events, coded errors, browser tracker, relay route, edge middleware and React error boundary",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "@autter/runtime-browser": "^1.6.0",
59
59
  "@autter/runtime-edge": "^1.1.0",
60
- "@autter/runtime-node": "^1.6.0"
60
+ "@autter/runtime-node": "^1.6.1"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": ">=18"