Skip to content

Commit 09fcd0e

Browse files
committed
documentation
1 parent cb51bb9 commit 09fcd0e

File tree

3 files changed

+125
-4
lines changed

3 files changed

+125
-4
lines changed

docs-devsite/_toc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,5 +675,7 @@ toc:
675675
- title: telemetry
676676
path: /docs/reference/js/telemetry.md
677677
section:
678+
- title: RequestErrorContext
679+
path: /docs/reference/js/telemetry.requesterrorcontext.md
678680
- title: Telemetry
679681
path: /docs/reference/js/telemetry.telemetry.md

docs-devsite/telemetry.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,28 @@ https://github.com/firebase/firebase-js-sdk
1818
| <b>function(app, ...)</b> |
1919
| [getTelemetry(app)](./telemetry.md#gettelemetry_cf608e1) | Returns the default [Telemetry](./telemetry.telemetry.md#telemetry_interface) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with the default settings. |
2020
| <b>function(telemetry, ...)</b> |
21-
| [captureError(telemetry, error)](./telemetry.md#captureerror_7c2d94e) | Enqueues an error to be uploaded to the Firebase Telemetry API. |
21+
| [captureError(telemetry, error, attributes)](./telemetry.md#captureerror_862e6b3) | Enqueues an error to be uploaded to the Firebase Telemetry API. |
2222
| [flush(telemetry)](./telemetry.md#flush_8975134) | Flushes all enqueued telemetry data immediately, instead of waiting for default batching. |
2323

2424
## Interfaces
2525

2626
| Interface | Description |
2727
| --- | --- |
28+
| [RequestErrorContext](./telemetry.requesterrorcontext.md#requesterrorcontext_interface) | Copyright 2025 Google LLC<!-- -->Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<!-- -->http://www.apache.org/licenses/LICENSE-2.0<!-- -->Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
2829
| [Telemetry](./telemetry.telemetry.md#telemetry_interface) | An instance of the Firebase Telemetry SDK.<!-- -->Do not create this instance directly. Instead, use [getTelemetry()](./telemetry.md#gettelemetry_cf608e1)<!-- -->. |
2930

31+
## Variables
32+
33+
| Variable | Description |
34+
| --- | --- |
35+
| [nextOnRequestError](./telemetry.md#nextonrequesterror) | Automatically report uncaught errors from server routes to Firebase Telemetry. |
36+
37+
## Type Aliases
38+
39+
| Type Alias | Description |
40+
| --- | --- |
41+
| [InstrumentationOnRequestError](./telemetry.md#instrumentationonrequesterror) | |
42+
3043
## function(app, ...)
3144

3245
### getTelemetry(app) {:#gettelemetry_cf608e1}
@@ -61,22 +74,23 @@ const telemetry = getTelemetry(app);
6174

6275
## function(telemetry, ...)
6376

64-
### captureError(telemetry, error) {:#captureerror_7c2d94e}
77+
### captureError(telemetry, error, attributes) {:#captureerror_862e6b3}
6578

6679
Enqueues an error to be uploaded to the Firebase Telemetry API.
6780

6881
<b>Signature:</b>
6982

7083
```typescript
71-
export declare function captureError(telemetry: Telemetry, error: unknown): void;
84+
export declare function captureError(telemetry: Telemetry, error: unknown, attributes?: AnyValueMap): void;
7285
```
7386

7487
#### Parameters
7588

7689
| Parameter | Type | Description |
7790
| --- | --- | --- |
7891
| telemetry | [Telemetry](./telemetry.telemetry.md#telemetry_interface) | The [Telemetry](./telemetry.telemetry.md#telemetry_interface) instance. |
79-
| error | unknown | the caught exception, typically an |
92+
| error | unknown | The caught exception, typically an |
93+
| attributes | AnyValueMap | = Optional, arbitrary attributes to attach to the error log |
8094

8195
<b>Returns:</b>
8296

@@ -104,3 +118,33 @@ Promise&lt;void&gt;
104118

105119
a promise which is resolved when all flushes are complete
106120

121+
## nextOnRequestError
122+
123+
Automatically report uncaught errors from server routes to Firebase Telemetry.
124+
125+
<b>Signature:</b>
126+
127+
```typescript
128+
nextOnRequestError: InstrumentationOnRequestError
129+
```
130+
131+
### Example
132+
133+
134+
```javascript
135+
// In instrumentation.ts (https://nextjs.org/docs/app/guides/instrumentation):
136+
export { nextOnRequestError as onRequestError } from 'firebase/telemetry'
137+
138+
```
139+
140+
## InstrumentationOnRequestError
141+
142+
<b>Signature:</b>
143+
144+
```typescript
145+
export type InstrumentationOnRequestError = (error: unknown, errorRequest: Readonly<{
146+
path: string;
147+
method: string;
148+
headers: NodeJS.Dict<string | string[]>;
149+
}>, errorContext: Readonly<RequestErrorContext>) => void | Promise<void>;
150+
```
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# RequestErrorContext interface
13+
Copyright 2025 Google LLC
14+
15+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
16+
17+
http://www.apache.org/licenses/LICENSE-2.0
18+
19+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
20+
21+
<b>Signature:</b>
22+
23+
```typescript
24+
export interface RequestErrorContext
25+
```
26+
27+
## Properties
28+
29+
| Property | Type | Description |
30+
| --- | --- | --- |
31+
| [renderSource](./telemetry.requesterrorcontext.md#requesterrorcontextrendersource) | 'react-server-components' \| 'react-server-components-payload' \| 'server-rendering' | |
32+
| [revalidateReason](./telemetry.requesterrorcontext.md#requesterrorcontextrevalidatereason) | 'on-demand' \| 'stale' \| undefined | |
33+
| [routePath](./telemetry.requesterrorcontext.md#requesterrorcontextroutepath) | string | |
34+
| [routerKind](./telemetry.requesterrorcontext.md#requesterrorcontextrouterkind) | 'Pages Router' \| 'App Router' | |
35+
| [routeType](./telemetry.requesterrorcontext.md#requesterrorcontextroutetype) | 'render' \| 'route' \| 'action' \| 'middleware' | |
36+
37+
## RequestErrorContext.renderSource
38+
39+
<b>Signature:</b>
40+
41+
```typescript
42+
renderSource?: 'react-server-components' | 'react-server-components-payload' | 'server-rendering';
43+
```
44+
45+
## RequestErrorContext.revalidateReason
46+
47+
<b>Signature:</b>
48+
49+
```typescript
50+
revalidateReason: 'on-demand' | 'stale' | undefined;
51+
```
52+
53+
## RequestErrorContext.routePath
54+
55+
<b>Signature:</b>
56+
57+
```typescript
58+
routePath: string;
59+
```
60+
61+
## RequestErrorContext.routerKind
62+
63+
<b>Signature:</b>
64+
65+
```typescript
66+
routerKind: 'Pages Router' | 'App Router';
67+
```
68+
69+
## RequestErrorContext.routeType
70+
71+
<b>Signature:</b>
72+
73+
```typescript
74+
routeType: 'render' | 'route' | 'action' | 'middleware';
75+
```

0 commit comments

Comments
 (0)