@replayio-app-building/netlify-recorder 0.15.4 → 0.15.5
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 +12 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ export default createRecordingRequestHandler(
|
|
|
112
112
|
|
|
113
113
|
### 2. Create recordings
|
|
114
114
|
|
|
115
|
-
When you want to turn a captured request into a Replay recording, POST to the service's `create-recording` endpoint with the request ID:
|
|
115
|
+
When you want to turn a captured request into a Replay recording, POST to the service's `create-recording` endpoint with the request ID. If the request was created with a secret, you must include it:
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
118
|
const response = await fetch(
|
|
@@ -122,6 +122,7 @@ const response = await fetch(
|
|
|
122
122
|
headers: { "Content-Type": "application/json" },
|
|
123
123
|
body: JSON.stringify({
|
|
124
124
|
requestId,
|
|
125
|
+
secret,
|
|
125
126
|
webhookUrl: "https://your-app.netlify.app/api/on-recording-complete", // optional
|
|
126
127
|
}),
|
|
127
128
|
}
|
|
@@ -144,17 +145,19 @@ On failure:
|
|
|
144
145
|
|
|
145
146
|
### 3. Check recording status
|
|
146
147
|
|
|
147
|
-
You can poll the recording status at any time:
|
|
148
|
+
You can poll the recording status at any time. If the request was created with a secret, you must include it:
|
|
148
149
|
|
|
149
150
|
```typescript
|
|
150
151
|
const res = await fetch(
|
|
151
|
-
`${RECORDER_URL}/api/get-request?requestId=${requestId}`
|
|
152
|
+
`${RECORDER_URL}/api/get-request?requestId=${requestId}&secret=${secret}`
|
|
152
153
|
);
|
|
153
154
|
const { status, recordingId } = await res.json();
|
|
154
155
|
// status: "captured" | "processing" | "recorded" | "failed"
|
|
155
156
|
// recordingId: string | null
|
|
156
157
|
```
|
|
157
158
|
|
|
159
|
+
Requests created with a secret return 403 if the secret is missing or incorrect.
|
|
160
|
+
|
|
158
161
|
### 4. Access control with secrets
|
|
159
162
|
|
|
160
163
|
You can restrict access to captured requests by setting a `secret` string. When a secret is set, the request is only accessible via API calls that provide the same secret value. This lets each app isolate its requests from other apps sharing the same Netlify Recorder service.
|
|
@@ -179,11 +182,11 @@ export default createRecordingRequestHandler(
|
|
|
179
182
|
|
|
180
183
|
#### Listing requests by secret
|
|
181
184
|
|
|
182
|
-
Use the `
|
|
185
|
+
Use the `requests` endpoint with a `secret` parameter to retrieve all requests associated with your secret, with optional filtering by status, handler path, and time range:
|
|
183
186
|
|
|
184
187
|
```typescript
|
|
185
188
|
const res = await fetch(
|
|
186
|
-
`${RECORDER_URL}/api/
|
|
189
|
+
`${RECORDER_URL}/api/requests?secret=${secret}&status=recorded&handlerPath=netlify/functions/my-handler&after=2025-01-01T00:00:00Z&before=2025-12-31T23:59:59Z`
|
|
187
190
|
);
|
|
188
191
|
const { rows, total, page, limit } = await res.json();
|
|
189
192
|
```
|
|
@@ -193,13 +196,16 @@ Query parameters:
|
|
|
193
196
|
| Parameter | Description |
|
|
194
197
|
|---|---|
|
|
195
198
|
| `secret` | **(required)** The secret string used when creating the requests |
|
|
196
|
-
| `
|
|
199
|
+
| `id` | Search by request ID prefix |
|
|
200
|
+
| `status` | Filter by status: `captured`, `queued`, `processing`, `recorded`, `failed`, `all` |
|
|
197
201
|
| `handlerPath` | Filter by handler path (exact match) |
|
|
198
202
|
| `after` | Only include requests created at or after this ISO timestamp |
|
|
199
203
|
| `before` | Only include requests created at or before this ISO timestamp |
|
|
200
204
|
| `page` | Page number (default 1) |
|
|
201
205
|
| `limit` | Page size (default 20, max 100) |
|
|
202
206
|
|
|
207
|
+
Without a `secret` parameter, only requests created without a secret are returned.
|
|
208
|
+
|
|
203
209
|
#### Checking request status with a secret
|
|
204
210
|
|
|
205
211
|
When a request was created with a secret, you must include the secret when polling its status:
|