* Compact, non-PII summary of a Lambda event for logging. The full * event payload can include the entire project config; we only emit * the routable fields (S3 URIs, chunk index, format) needed to triage * a failure from CloudWatch.
( event: PlanEvent | RenderChunkEvent | AssembleEvent, )
| 179 | * a failure from CloudWatch. |
| 180 | */ |
| 181 | function summarizeEvent( |
| 182 | event: PlanEvent | RenderChunkEvent | AssembleEvent, |
| 183 | ): Record<string, unknown> { |
| 184 | switch (event.Action) { |
| 185 | case "plan": |
| 186 | return { |
| 187 | projectS3Uri: event.ProjectS3Uri, |
| 188 | planOutputS3Prefix: event.PlanOutputS3Prefix, |
| 189 | format: event.Config.format, |
| 190 | fps: event.Config.fps, |
| 191 | }; |
| 192 | case "renderChunk": |
| 193 | return { |
| 194 | planS3Uri: event.PlanS3Uri, |
| 195 | chunkIndex: event.ChunkIndex, |
| 196 | format: event.Format, |
| 197 | }; |
| 198 | case "assemble": |
| 199 | return { |
| 200 | planS3Uri: event.PlanS3Uri, |
| 201 | chunkCount: event.ChunkS3Uris.length, |
| 202 | hasAudio: event.AudioS3Uri !== null, |
| 203 | outputS3Uri: event.OutputS3Uri, |
| 204 | format: event.Format, |
| 205 | }; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Lambda sets `TMPDIR` to `/tmp` already, but the bundled binaries (Chrome |