@replayio-app-building/netlify-recorder 0.45.0 → 0.46.0

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.
Files changed (2) hide show
  1. package/README.md +15 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -169,6 +169,21 @@ const status = await fetch(
169
169
  | `not_found` | 404 | Request ID not found in `backend_requests` |
170
170
  | `error` | 4xx/5xx | Validation error, auth failure, or recording failure |
171
171
 
172
+ #### Warm-start replay (preceding requests)
173
+
174
+ Netlify Functions run on AWS Lambda, where module-level state persists across invocations on the same container instance (warm starts). For example, a module-level `Map` used as a cache will retain entries across requests handled by the same container. This means a recording of a warm-start request may behave differently than the original if module-level state is empty.
175
+
176
+ The recorder handles this automatically. `createRecordingRequestHandler` maintains a module-level `originalRequestId` that captures the ID of the first request handled by each module instance. Every subsequent request on the same instance includes this reference in its blob data, linking all requests from the same warm-start chain.
177
+
178
+ When a recording is triggered for a request that has an `originalRequestId`, the recording service:
179
+
180
+ 1. Looks up all preceding requests from the same module instance (same `original_request_id`, earlier `created_at`)
181
+ 2. Fetches the blob data for each preceding request
182
+ 3. Replays the preceding requests in order on the handler module before executing the target request — each preceding request runs with its own replay interceptors so recorded network responses are served without making real calls
183
+ 4. Executes the target request, now with module-level state populated exactly as it was in production
184
+
185
+ This is fully automatic — no configuration or code changes are needed beyond wrapping your handlers with `createRecordingRequestHandler`. The `original_request_id` column is stored in the `backend_requests` table and the preceding blob URLs are resolved server-side.
186
+
172
187
  ### 5. Create recordings programmatically
173
188
 
174
189
  Use `ensureRequestRecording` to turn a captured request into a Replay recording. It checks the `backend_requests` table first — if a recording already exists, it returns the recording ID immediately without calling the service. Otherwise it passes the stored blob data URL to the Netlify Recorder service and updates the row status to `"queued"`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayio-app-building/netlify-recorder",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Capture and replay Netlify function executions as Replay recordings",
5
5
  "type": "module",
6
6
  "exports": {