@remotion/lambda 4.0.163 → 4.0.165
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/dist/api/delete-render.js +7 -3
- package/dist/api/deploy-function.d.ts +0 -1
- package/dist/api/deploy-function.js +3 -3
- package/dist/api/deploy-site.d.ts +3 -3
- package/dist/api/download-media.js +6 -3
- package/dist/api/get-compositions-on-lambda.js +0 -2
- package/dist/api/get-render-progress.js +0 -2
- package/dist/api/make-lambda-payload.js +2 -1
- package/dist/api/render-media-on-lambda.js +0 -2
- package/dist/api/render-still-on-lambda.js +37 -25
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/commands/functions/ls.js +3 -1
- package/dist/cli/commands/render/progress.d.ts +3 -28
- package/dist/cli/commands/render/progress.js +89 -90
- package/dist/cli/commands/render/render.js +7 -40
- package/dist/cli/commands/sites/create.js +2 -2
- package/dist/functions/chunk-optimization/types.d.ts +0 -3
- package/dist/functions/helpers/calculate-chunk-times.d.ts +3 -4
- package/dist/functions/helpers/calculate-chunk-times.js +4 -8
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +3 -5
- package/dist/functions/helpers/calculate-price-from-bucket.js +5 -18
- package/dist/functions/helpers/clean-tmpdir.d.ts +0 -2
- package/dist/functions/helpers/clean-tmpdir.js +1 -7
- package/dist/functions/helpers/concat-videos.d.ts +1 -13
- package/dist/functions/helpers/concat-videos.js +7 -131
- package/dist/functions/helpers/create-post-render-data.d.ts +6 -6
- package/dist/functions/helpers/create-post-render-data.js +17 -37
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -3
- package/dist/functions/helpers/find-output-file-in-bucket.js +1 -4
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-progress-step-size.js +0 -3
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -6
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -13
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +8 -0
- package/dist/functions/helpers/get-overall-progress-s3.js +25 -0
- package/dist/functions/helpers/get-overall-progress.d.ts +1 -2
- package/dist/functions/helpers/get-overall-progress.js +2 -4
- package/dist/functions/helpers/get-progress.js +78 -154
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
- package/dist/functions/helpers/get-retry-stats.js +0 -18
- package/dist/functions/helpers/inspect-errors.d.ts +4 -10
- package/dist/functions/helpers/inspect-errors.js +5 -27
- package/dist/functions/helpers/io.d.ts +0 -1
- package/dist/functions/helpers/io.js +2 -3
- package/dist/functions/helpers/lifecycle.d.ts +0 -4
- package/dist/functions/helpers/lifecycle.js +2 -3
- package/dist/functions/helpers/make-timeout-error.d.ts +0 -2
- package/dist/functions/helpers/merge-chunks.d.ts +5 -7
- package/dist/functions/helpers/merge-chunks.js +16 -149
- package/dist/functions/helpers/min-max.d.ts +1 -1
- package/dist/functions/helpers/min-max.js +1 -1
- package/dist/functions/helpers/overall-render-progress.d.ts +49 -0
- package/dist/functions/helpers/overall-render-progress.js +164 -0
- package/dist/functions/helpers/stream-renderer.d.ts +11 -0
- package/dist/functions/helpers/stream-renderer.js +127 -0
- package/dist/functions/helpers/streamify-response.d.ts +0 -3
- package/dist/functions/helpers/streamify-response.js +2 -14
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/helpers/write-lambda-error.d.ts +3 -6
- package/dist/functions/helpers/write-lambda-error.js +1 -21
- package/dist/functions/index.d.ts +5 -0
- package/dist/functions/index.js +70 -51
- package/dist/functions/launch.js +103 -200
- package/dist/functions/renderer.d.ts +2 -2
- package/dist/functions/renderer.js +70 -123
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +3 -2
- package/dist/functions/still.d.ts +7 -2
- package/dist/functions/still.js +17 -34
- package/dist/functions/streaming/stream-writer.d.ts +6 -0
- package/dist/functions/streaming/stream-writer.js +35 -0
- package/dist/functions/streaming/streaming.d.ts +92 -0
- package/dist/functions/streaming/streaming.js +58 -0
- package/dist/internals.d.ts +7 -6
- package/dist/shared/aws-clients.js +8 -0
- package/dist/shared/call-lambda.d.ts +5 -4
- package/dist/shared/call-lambda.js +53 -44
- package/dist/shared/constants.d.ts +15 -49
- package/dist/shared/constants.js +3 -32
- package/dist/shared/content-disposition-header.d.ts +0 -3
- package/dist/shared/get-function-version.js +0 -2
- package/dist/shared/is-flaky-error.js +4 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -2
- package/dist/shared/parse-lambda-timings-key.js +0 -14
- package/dist/shared/return-values.d.ts +0 -7
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
package/dist/functions/launch.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.launchHandler = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
5
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
6
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
7
|
const version_1 = require("remotion/version");
|
|
8
|
-
const aws_clients_1 = require("../shared/aws-clients");
|
|
9
8
|
const compress_props_1 = require("../shared/compress-props");
|
|
10
9
|
const constants_1 = require("../shared/constants");
|
|
11
10
|
const docs_url_1 = require("../shared/docs-url");
|
|
12
|
-
const get_aws_urls_1 = require("../shared/get-aws-urls");
|
|
13
11
|
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
14
12
|
const validate_1 = require("../shared/validate");
|
|
15
13
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
@@ -21,40 +19,12 @@ const expected_out_name_1 = require("./helpers/expected-out-name");
|
|
|
21
19
|
const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-bucket");
|
|
22
20
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
23
21
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
24
|
-
const io_1 = require("./helpers/io");
|
|
25
22
|
const merge_chunks_1 = require("./helpers/merge-chunks");
|
|
26
|
-
const
|
|
23
|
+
const overall_render_progress_1 = require("./helpers/overall-render-progress");
|
|
24
|
+
const stream_renderer_1 = require("./helpers/stream-renderer");
|
|
27
25
|
const validate_composition_1 = require("./helpers/validate-composition");
|
|
28
26
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
29
|
-
const
|
|
30
|
-
try {
|
|
31
|
-
const result = await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
32
|
-
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
33
|
-
Payload: JSON.stringify(payload),
|
|
34
|
-
InvocationType: 'Event',
|
|
35
|
-
}));
|
|
36
|
-
if (result.FunctionError) {
|
|
37
|
-
throw new Error(`Lambda function ${functionName} returned an error: ${result.FunctionError} ${result.LogResult}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
if (err.name === 'ResourceConflictException') {
|
|
42
|
-
if (retries > 10) {
|
|
43
|
-
throw err;
|
|
44
|
-
}
|
|
45
|
-
await new Promise((resolve) => {
|
|
46
|
-
setTimeout(resolve, 1000);
|
|
47
|
-
});
|
|
48
|
-
return callFunctionWithRetry({
|
|
49
|
-
payload,
|
|
50
|
-
retries: retries + 1,
|
|
51
|
-
functionName,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
throw err;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAvailable, }) => {
|
|
27
|
+
const innerLaunchHandler = async ({ functionName, params, options, overallProgress, }) => {
|
|
58
28
|
var _a, _b, _c, _d, _e;
|
|
59
29
|
if (params.type !== constants_1.LambdaRoutines.launch) {
|
|
60
30
|
throw new Error('Expected launch type');
|
|
@@ -76,6 +46,7 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
76
46
|
renderer_1.RenderInternals.Log.info(logOptions, 'Waiting for browser to be ready:', serializedInputPropsWithCustomSchema);
|
|
77
47
|
const { instance } = await browserInstance;
|
|
78
48
|
renderer_1.RenderInternals.Log.info(logOptions, 'Validating composition, input props:', serializedInputPropsWithCustomSchema);
|
|
49
|
+
const startTime = Date.now();
|
|
79
50
|
const comp = await (0, validate_composition_1.validateComposition)({
|
|
80
51
|
serveUrl: params.serveUrl,
|
|
81
52
|
composition: params.composition,
|
|
@@ -132,8 +103,8 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
132
103
|
if (chunks.length > constants_1.MAX_FUNCTIONS_PER_RENDER) {
|
|
133
104
|
throw new Error(`Too many functions: This render would cause ${chunks.length} functions to spawn. We limit this amount to ${constants_1.MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${docs_url_1.DOCS_URL}/docs/lambda/concurrency#too-many-functions for help.`);
|
|
134
105
|
}
|
|
106
|
+
overallProgress.setExpectedChunks(chunks.length);
|
|
135
107
|
const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
|
|
136
|
-
const reqSend = (0, timer_1.timer)('sending off requests', params.logLevel);
|
|
137
108
|
const serializedResolved = (0, compress_props_1.serializeOrThrow)(comp.props, 'resolved-props');
|
|
138
109
|
const needsToUpload = (0, compress_props_1.getNeedsToUpload)('video-or-audio', [
|
|
139
110
|
serializedResolved.length,
|
|
@@ -149,6 +120,9 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
149
120
|
needsToUpload,
|
|
150
121
|
});
|
|
151
122
|
const fps = comp.fps / params.everyNthFrame;
|
|
123
|
+
// If for 150 functions, we stream every frame, we DDos ourselves.
|
|
124
|
+
// Throttling a bit, allowing more progress if there is lower concurrency.
|
|
125
|
+
const progressEveryNthFrame = Math.ceil(chunks.length / 15);
|
|
152
126
|
const lambdaPayloads = chunks.map((chunkPayload) => {
|
|
153
127
|
var _a;
|
|
154
128
|
const payload = {
|
|
@@ -196,6 +170,7 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
196
170
|
preferLossless: params.preferLossless,
|
|
197
171
|
compositionStart: realFrameRange[0],
|
|
198
172
|
framesPerLambda,
|
|
173
|
+
progressEveryNthFrame,
|
|
199
174
|
};
|
|
200
175
|
return payload;
|
|
201
176
|
});
|
|
@@ -236,40 +211,36 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
236
211
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
237
212
|
? null
|
|
238
213
|
: (_e = (_d = params.outName) === null || _d === void 0 ? void 0 : _d.s3OutputProvider) !== null && _e !== void 0 ? _e : null);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
await (0, io_1.lambdaDeleteFile)({
|
|
249
|
-
bucketName: renderBucketName,
|
|
250
|
-
customCredentials,
|
|
251
|
-
key,
|
|
252
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${(0, get_current_region_1.getCurrentRegionInFunction)()}" already exists. Delete it before re-rendering, or use the overwrite option to delete it before render."`);
|
|
214
|
+
if (!params.overwrite) {
|
|
215
|
+
const output = await (0, find_output_file_in_bucket_1.findOutputFileInBucket)({
|
|
216
|
+
bucketName: params.bucketName,
|
|
217
|
+
customCredentials,
|
|
218
|
+
renderMetadata,
|
|
219
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
220
|
+
});
|
|
221
|
+
if (output) {
|
|
222
|
+
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${(0, get_current_region_1.getCurrentRegionInFunction)()}" already exists. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda() to overwrite it."`);
|
|
257
223
|
}
|
|
258
224
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
225
|
+
overallProgress.setRenderMetadata(renderMetadata);
|
|
226
|
+
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
227
|
+
if ((0, fs_1.existsSync)(outdir)) {
|
|
228
|
+
(0, fs_1.rmSync)(outdir, {
|
|
229
|
+
recursive: true,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
(0, fs_1.mkdirSync)(outdir);
|
|
233
|
+
const files = [];
|
|
269
234
|
await Promise.all(lambdaPayloads.map(async (payload) => {
|
|
270
|
-
await
|
|
235
|
+
await (0, stream_renderer_1.streamRendererFunctionWithRetry)({
|
|
236
|
+
files,
|
|
237
|
+
functionName,
|
|
238
|
+
outdir,
|
|
239
|
+
overallProgress,
|
|
240
|
+
payload,
|
|
241
|
+
logLevel: params.logLevel,
|
|
242
|
+
});
|
|
271
243
|
}));
|
|
272
|
-
reqSend.end();
|
|
273
244
|
const postRenderData = await (0, merge_chunks_1.mergeChunksAndFinishRender)({
|
|
274
245
|
bucketName: params.bucketName,
|
|
275
246
|
renderId: params.renderId,
|
|
@@ -288,13 +259,16 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
288
259
|
inputProps: params.inputProps,
|
|
289
260
|
serializedResolvedProps,
|
|
290
261
|
renderMetadata,
|
|
291
|
-
onAllChunks: onAllChunksAvailable,
|
|
292
262
|
audioBitrate: params.audioBitrate,
|
|
293
263
|
logLevel: params.logLevel,
|
|
294
264
|
framesPerLambda,
|
|
295
265
|
binariesDirectory: null,
|
|
296
266
|
preferLossless: params.preferLossless,
|
|
297
267
|
compositionStart: realFrameRange[0],
|
|
268
|
+
outdir,
|
|
269
|
+
files: files.sort(),
|
|
270
|
+
overallProgress,
|
|
271
|
+
startTime,
|
|
298
272
|
});
|
|
299
273
|
return postRenderData;
|
|
300
274
|
};
|
|
@@ -303,7 +277,6 @@ const launchHandler = async (params, options) => {
|
|
|
303
277
|
if (params.type !== constants_1.LambdaRoutines.launch) {
|
|
304
278
|
throw new Error('Expected launch type');
|
|
305
279
|
}
|
|
306
|
-
let allChunksAvailable = null;
|
|
307
280
|
const functionName = (_a = params.rendererFunctionName) !== null && _a !== void 0 ? _a : process.env.AWS_LAMBDA_FUNCTION_NAME;
|
|
308
281
|
const logOptions = {
|
|
309
282
|
indent: false,
|
|
@@ -311,62 +284,7 @@ const launchHandler = async (params, options) => {
|
|
|
311
284
|
};
|
|
312
285
|
const onTimeout = async () => {
|
|
313
286
|
var _a;
|
|
314
|
-
|
|
315
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'All chunks are available, but the function is about to time out.');
|
|
316
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'Spawning another function to merge chunks.');
|
|
317
|
-
try {
|
|
318
|
-
await callFunctionWithRetry({
|
|
319
|
-
functionName,
|
|
320
|
-
payload: {
|
|
321
|
-
type: constants_1.LambdaRoutines.merge,
|
|
322
|
-
renderId: params.renderId,
|
|
323
|
-
bucketName: params.bucketName,
|
|
324
|
-
outName: params.outName,
|
|
325
|
-
serializedResolvedProps: allChunksAvailable.serializedResolvedProps,
|
|
326
|
-
inputProps: allChunksAvailable.inputProps,
|
|
327
|
-
logLevel: params.logLevel,
|
|
328
|
-
framesPerLambda: allChunksAvailable.framesPerLambda,
|
|
329
|
-
preferLossless: params.preferLossless,
|
|
330
|
-
compositionStart: allChunksAvailable.compositionStart,
|
|
331
|
-
},
|
|
332
|
-
retries: 2,
|
|
333
|
-
});
|
|
334
|
-
renderer_1.RenderInternals.Log.info(logOptions, `New function successfully invoked. See the CloudWatch logs for it:`);
|
|
335
|
-
renderer_1.RenderInternals.Log.info(logOptions, (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
336
|
-
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
337
|
-
method: constants_1.LambdaRoutines.merge,
|
|
338
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
339
|
-
rendererFunctionName: params.rendererFunctionName,
|
|
340
|
-
renderId: params.renderId,
|
|
341
|
-
}));
|
|
342
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'This function will now time out.');
|
|
343
|
-
}
|
|
344
|
-
catch (err) {
|
|
345
|
-
if (process.env.NODE_ENV === 'test') {
|
|
346
|
-
throw err;
|
|
347
|
-
}
|
|
348
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke additional function to merge videos:');
|
|
349
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, err);
|
|
350
|
-
await (0, write_lambda_error_1.writeLambdaError)({
|
|
351
|
-
bucketName: params.bucketName,
|
|
352
|
-
errorInfo: {
|
|
353
|
-
type: 'stitcher',
|
|
354
|
-
message: err.message,
|
|
355
|
-
name: err.name,
|
|
356
|
-
stack: err.stack,
|
|
357
|
-
tmpDir: null,
|
|
358
|
-
frame: 0,
|
|
359
|
-
chunk: 0,
|
|
360
|
-
isFatal: false,
|
|
361
|
-
attempt: 1,
|
|
362
|
-
willRetry: false,
|
|
363
|
-
totalAttempts: 1,
|
|
364
|
-
},
|
|
365
|
-
renderId: params.renderId,
|
|
366
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
}
|
|
287
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Function is about to time out. Can not finish render.');
|
|
370
288
|
if (!params.webhook) {
|
|
371
289
|
return;
|
|
372
290
|
}
|
|
@@ -394,42 +312,39 @@ const launchHandler = async (params, options) => {
|
|
|
394
312
|
}
|
|
395
313
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
396
314
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, err);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
willRetry: false,
|
|
410
|
-
totalAttempts: 1,
|
|
411
|
-
},
|
|
412
|
-
renderId: params.renderId,
|
|
413
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
315
|
+
overallProgress.addErrorWithoutUpload({
|
|
316
|
+
type: 'webhook',
|
|
317
|
+
message: err.message,
|
|
318
|
+
name: err.name,
|
|
319
|
+
stack: err.stack,
|
|
320
|
+
tmpDir: null,
|
|
321
|
+
frame: 0,
|
|
322
|
+
chunk: 0,
|
|
323
|
+
isFatal: false,
|
|
324
|
+
attempt: 1,
|
|
325
|
+
willRetry: false,
|
|
326
|
+
totalAttempts: 1,
|
|
414
327
|
});
|
|
328
|
+
overallProgress.upload();
|
|
415
329
|
}
|
|
416
330
|
};
|
|
417
331
|
let webhookInvoked = false;
|
|
418
332
|
const webhookDueToTimeout = setTimeout(onTimeout, Math.max(options.getRemainingTimeInMillis() - 1000, 1000));
|
|
419
333
|
renderer_1.RenderInternals.Log.info(logOptions, `Function has ${Math.max(options.getRemainingTimeInMillis() - 1000, 1000)} before it times out`);
|
|
334
|
+
const overallProgress = (0, overall_render_progress_1.makeOverallRenderProgress)({
|
|
335
|
+
renderId: params.renderId,
|
|
336
|
+
bucketName: params.bucketName,
|
|
337
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
338
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
339
|
+
timeoutTimestamp: options.getRemainingTimeInMillis() + Date.now(),
|
|
340
|
+
logLevel: params.logLevel,
|
|
341
|
+
});
|
|
420
342
|
try {
|
|
421
343
|
const postRenderData = await innerLaunchHandler({
|
|
422
344
|
functionName,
|
|
423
345
|
params,
|
|
424
346
|
options,
|
|
425
|
-
|
|
426
|
-
allChunksAvailable = {
|
|
427
|
-
inputProps,
|
|
428
|
-
serializedResolvedProps,
|
|
429
|
-
framesPerLambda,
|
|
430
|
-
compositionStart,
|
|
431
|
-
};
|
|
432
|
-
},
|
|
347
|
+
overallProgress,
|
|
433
348
|
});
|
|
434
349
|
clearTimeout(webhookDueToTimeout);
|
|
435
350
|
if (!params.webhook || webhookInvoked) {
|
|
@@ -461,24 +376,20 @@ const launchHandler = async (params, options) => {
|
|
|
461
376
|
if (process.env.NODE_ENV === 'test') {
|
|
462
377
|
throw err;
|
|
463
378
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
willRetry: false,
|
|
477
|
-
totalAttempts: 1,
|
|
478
|
-
},
|
|
479
|
-
renderId: params.renderId,
|
|
480
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
379
|
+
overallProgress.addErrorWithoutUpload({
|
|
380
|
+
type: 'webhook',
|
|
381
|
+
message: err.message,
|
|
382
|
+
name: err.name,
|
|
383
|
+
stack: err.stack,
|
|
384
|
+
tmpDir: null,
|
|
385
|
+
frame: 0,
|
|
386
|
+
chunk: 0,
|
|
387
|
+
isFatal: false,
|
|
388
|
+
attempt: 1,
|
|
389
|
+
willRetry: false,
|
|
390
|
+
totalAttempts: 1,
|
|
481
391
|
});
|
|
392
|
+
overallProgress.upload();
|
|
482
393
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
483
394
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, err);
|
|
484
395
|
}
|
|
@@ -491,24 +402,20 @@ const launchHandler = async (params, options) => {
|
|
|
491
402
|
throw err;
|
|
492
403
|
}
|
|
493
404
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Error occurred', err);
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
willRetry: false,
|
|
507
|
-
message: err.message,
|
|
508
|
-
},
|
|
509
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
510
|
-
renderId: params.renderId,
|
|
405
|
+
overallProgress.addErrorWithoutUpload({
|
|
406
|
+
chunk: null,
|
|
407
|
+
frame: null,
|
|
408
|
+
name: err.name,
|
|
409
|
+
stack: err.stack,
|
|
410
|
+
type: 'stitcher',
|
|
411
|
+
isFatal: true,
|
|
412
|
+
tmpDir: (0, write_lambda_error_1.getTmpDirStateIfENoSp)(err.stack),
|
|
413
|
+
attempt: 1,
|
|
414
|
+
totalAttempts: 1,
|
|
415
|
+
willRetry: false,
|
|
416
|
+
message: err.message,
|
|
511
417
|
});
|
|
418
|
+
await overallProgress.upload();
|
|
512
419
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Wrote error to S3');
|
|
513
420
|
clearTimeout(webhookDueToTimeout);
|
|
514
421
|
if (params.webhook && !webhookInvoked) {
|
|
@@ -536,24 +443,20 @@ const launchHandler = async (params, options) => {
|
|
|
536
443
|
if (process.env.NODE_ENV === 'test') {
|
|
537
444
|
throw error;
|
|
538
445
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
willRetry: false,
|
|
552
|
-
totalAttempts: 1,
|
|
553
|
-
},
|
|
554
|
-
renderId: params.renderId,
|
|
555
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
446
|
+
overallProgress.addErrorWithoutUpload({
|
|
447
|
+
type: 'webhook',
|
|
448
|
+
message: err.message,
|
|
449
|
+
name: err.name,
|
|
450
|
+
stack: err.stack,
|
|
451
|
+
tmpDir: null,
|
|
452
|
+
frame: 0,
|
|
453
|
+
chunk: 0,
|
|
454
|
+
isFatal: false,
|
|
455
|
+
attempt: 1,
|
|
456
|
+
willRetry: false,
|
|
457
|
+
totalAttempts: 1,
|
|
556
458
|
});
|
|
459
|
+
overallProgress.upload();
|
|
557
460
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
558
461
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, error);
|
|
559
462
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { LambdaPayload } from '../shared/constants';
|
|
2
2
|
import type { RequestContext } from './helpers/request-context';
|
|
3
|
+
import type { OnStream } from './streaming/streaming';
|
|
3
4
|
type Options = {
|
|
4
5
|
expectedBucketOwner: string;
|
|
5
6
|
isWarm: boolean;
|
|
6
7
|
};
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const rendererHandler: (params: LambdaPayload, options: Options, requestContext: RequestContext) => Promise<{
|
|
8
|
+
export declare const rendererHandler: (params: LambdaPayload, options: Options, onStream: OnStream, requestContext: RequestContext) => Promise<{
|
|
9
9
|
type: 'success';
|
|
10
10
|
}>;
|
|
11
11
|
export {};
|