@remotion/lambda 4.0.244 → 4.0.246
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/LICENSE.md +1 -1
- package/dist/admin/make-layer-public.js +10 -11
- package/dist/api/app-router-webhook.d.ts +10 -0
- package/dist/api/app-router-webhook.js +43 -0
- package/dist/api/create-function.d.ts +1 -2
- package/dist/api/create-function.js +10 -10
- package/dist/api/delete-function.d.ts +4 -13
- package/dist/api/delete-function.js +2 -5
- package/dist/api/delete-render.d.ts +0 -8
- package/dist/api/delete-render.js +4 -10
- package/dist/api/delete-site.d.ts +0 -10
- package/dist/api/delete-site.js +4 -11
- package/dist/api/deploy-function.d.ts +8 -15
- package/dist/api/deploy-function.js +21 -27
- package/dist/api/deploy-site.d.ts +2 -11
- package/dist/api/deploy-site.js +14 -22
- package/dist/api/download-media.d.ts +0 -11
- package/dist/api/download-media.js +3 -12
- package/dist/api/estimate-price.d.ts +0 -6
- package/dist/api/estimate-price.js +1 -3
- package/dist/api/get-aws-client.d.ts +1 -9
- package/dist/api/get-aws-client.js +2 -6
- package/dist/api/get-compositions-on-lambda.d.ts +1 -14
- package/dist/api/get-compositions-on-lambda.js +12 -17
- package/dist/api/get-function-info.d.ts +1 -14
- package/dist/api/get-function-info.js +2 -5
- package/dist/api/get-functions.d.ts +1 -8
- package/dist/api/get-functions.js +2 -5
- package/dist/api/get-or-create-bucket.d.ts +0 -6
- package/dist/api/get-or-create-bucket.js +3 -5
- package/dist/api/get-regions.d.ts +0 -5
- package/dist/api/get-regions.js +3 -4
- package/dist/api/get-render-progress.d.ts +0 -10
- package/dist/api/get-render-progress.js +3 -11
- package/dist/api/get-sites.d.ts +0 -6
- package/dist/api/get-sites.js +4 -7
- package/dist/api/iam-validation/simulate.d.ts +0 -7
- package/dist/api/iam-validation/simulate.js +2 -5
- package/dist/api/iam-validation/suggested-policy.d.ts +0 -10
- package/dist/api/iam-validation/suggested-policy.js +2 -4
- package/dist/api/make-lambda-payload.d.ts +2 -1
- package/dist/api/make-lambda-payload.js +19 -13
- package/dist/api/pages-router-webhook.d.ts +3 -0
- package/dist/api/pages-router-webhook.js +47 -0
- package/dist/api/presign-url.d.ts +0 -10
- package/dist/api/presign-url.js +2 -8
- package/dist/api/render-media-on-lambda.d.ts +1 -20
- package/dist/api/render-media-on-lambda.js +4 -19
- package/dist/api/render-still-on-lambda.d.ts +2 -19
- package/dist/api/render-still-on-lambda.js +6 -17
- package/dist/api/speculate-function-name.d.ts +0 -8
- package/dist/api/speculate-function-name.js +3 -7
- package/dist/api/upload-dir.d.ts +1 -7
- package/dist/api/upload-dir.js +1 -5
- package/dist/api/validate-webhook-signature.d.ts +0 -8
- package/dist/api/validate-webhook-signature.js +3 -7
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/commands/compositions/index.d.ts +7 -1
- package/dist/cli/commands/compositions/index.js +2 -2
- package/dist/cli/commands/functions/deploy.d.ts +7 -1
- package/dist/cli/commands/functions/deploy.js +7 -2
- package/dist/cli/commands/functions/index.d.ts +8 -1
- package/dist/cli/commands/functions/index.js +8 -4
- package/dist/cli/commands/functions/ls.d.ts +6 -1
- package/dist/cli/commands/functions/ls.js +2 -3
- package/dist/cli/commands/functions/rmall.d.ts +6 -1
- package/dist/cli/commands/functions/rmall.js +2 -3
- package/dist/cli/commands/render/render.d.ts +6 -1
- package/dist/cli/commands/render/render.js +9 -7
- package/dist/cli/commands/sites/create.js +2 -0
- package/dist/cli/commands/sites/index.d.ts +1 -1
- package/dist/cli/commands/sites/index.js +4 -4
- package/dist/cli/commands/still.d.ts +2 -2
- package/dist/cli/commands/still.js +5 -5
- package/dist/cli/get-aws-region.js +0 -4
- package/dist/cli/helpers/find-function-name.d.ts +6 -1
- package/dist/cli/helpers/find-function-name.js +4 -5
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +36 -16
- package/dist/client.d.ts +17 -22
- package/dist/client.js +17 -13
- package/dist/functions/aws-implementation.d.ts +13 -1
- package/dist/functions/aws-implementation.js +46 -0
- package/dist/functions/aws-server-implementation.d.ts +2 -0
- package/dist/functions/aws-server-implementation.js +25 -0
- package/dist/functions/full-client-implementation.d.ts +3 -0
- package/dist/functions/full-client-implementation.js +16 -0
- package/dist/functions/helpers/clean-tmpdir.js +1 -3
- package/dist/functions/helpers/get-current-region.js +0 -4
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +3 -7
- package/dist/functions/helpers/get-output-url-from-metadata.js +1 -1
- package/dist/functions/helpers/lifecycle.d.ts +4 -2
- package/dist/functions/helpers/lifecycle.js +3 -18
- package/dist/functions/helpers/timer.d.ts +2 -4
- package/dist/functions/http-client.d.ts +7 -0
- package/dist/functions/http-client.js +22 -0
- package/dist/functions/index.d.ts +1 -8
- package/dist/functions/index.js +12 -235
- package/dist/index.d.ts +6 -6
- package/dist/index.js +27 -6
- package/dist/internals.d.ts +6 -5
- package/dist/pricing/price-per-1-s.js +102 -0
- package/dist/regions.d.ts +1 -1
- package/dist/regions.js +3 -0
- package/dist/shared/call-lambda-async.d.ts +3 -0
- package/dist/shared/call-lambda-async.js +20 -0
- package/dist/shared/call-lambda-streaming.d.ts +7 -0
- package/dist/shared/{call-lambda.js → call-lambda-streaming.js} +36 -61
- package/dist/shared/call-lambda-sync.d.ts +3 -0
- package/dist/shared/call-lambda-sync.js +30 -0
- package/dist/shared/check-credentials.js +2 -3
- package/dist/shared/constants.d.ts +2 -91
- package/dist/shared/constants.js +1 -8
- package/dist/shared/convert-to-serve-url.js +2 -2
- package/dist/shared/get-account-id.d.ts +3 -4
- package/dist/shared/get-account-id.js +3 -3
- package/dist/shared/get-aws-urls.d.ts +4 -8
- package/dist/shared/get-aws-urls.js +1 -1
- package/dist/shared/get-function-version.js +4 -4
- package/dist/shared/get-layers.d.ts +1 -2
- package/dist/shared/get-layers.js +2 -4
- package/dist/shared/get-s3-operations.d.ts +4 -1
- package/dist/shared/get-s3-operations.js +2 -3
- package/dist/shared/get-service-client.js +2 -2
- package/dist/shared/hosted-layers.d.ts +0 -1
- package/dist/shared/hosted-layers.js +139 -537
- package/dist/shared/lambda-insights-extensions.d.ts +1 -1
- package/dist/shared/lambda-insights-extensions.js +3 -0
- package/dist/shared/read-dir.d.ts +2 -10
- package/dist/shared/read-dir.js +5 -4
- package/dist/shared/validate-aws-region.js +1 -1
- package/dist/shared/validate-bucketname.d.ts +1 -1
- package/package.json +15 -15
- package/remotionlambda-arm64.zip +0 -0
- package/dist/api/__mocks__/clean-items.d.ts +0 -2
- package/dist/api/__mocks__/clean-items.js +0 -24
- package/dist/api/__mocks__/create-function.d.ts +0 -2
- package/dist/api/__mocks__/create-function.js +0 -21
- package/dist/api/__mocks__/delete-function.d.ts +0 -2
- package/dist/api/__mocks__/delete-function.js +0 -9
- package/dist/api/__mocks__/get-functions.d.ts +0 -2
- package/dist/api/__mocks__/get-functions.js +0 -9
- package/dist/api/__mocks__/upload-dir.d.ts +0 -3
- package/dist/api/__mocks__/upload-dir.js +0 -47
- package/dist/api/mock-functions.d.ts +0 -18
- package/dist/api/mock-functions.js +0 -36
- package/dist/cli/helpers/__mocks__/quit.d.ts +0 -1
- package/dist/cli/helpers/__mocks__/quit.js +0 -7
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +0 -7
- package/dist/functions/chunk-optimization/plan-frame-ranges.js +0 -17
- package/dist/functions/chunk-optimization/types.d.ts +0 -8
- package/dist/functions/chunk-optimization/types.js +0 -2
- package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +0 -3
- package/dist/functions/helpers/__mocks__/get-browser-instance.js +0 -12
- package/dist/functions/helpers/__mocks__/leak-detection.d.ts +0 -4
- package/dist/functions/helpers/__mocks__/leak-detection.js +0 -9
- package/dist/functions/helpers/__mocks__/timer.d.ts +0 -2
- package/dist/functions/helpers/__mocks__/timer.js +0 -10
- package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -1
- package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -17
- package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -5
- package/dist/functions/helpers/calculate-chunk-times.js +0 -29
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +0 -15
- package/dist/functions/helpers/calculate-price-from-bucket.js +0 -30
- package/dist/functions/helpers/can-concat-seamlessly.d.ts +0 -3
- package/dist/functions/helpers/can-concat-seamlessly.js +0 -17
- package/dist/functions/helpers/cleanup-props.d.ts +0 -8
- package/dist/functions/helpers/cleanup-props.js +0 -23
- package/dist/functions/helpers/concat-videos.d.ts +0 -23
- package/dist/functions/helpers/concat-videos.js +0 -54
- package/dist/functions/helpers/create-post-render-data.d.ts +0 -17
- package/dist/functions/helpers/create-post-render-data.js +0 -67
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +0 -14
- package/dist/functions/helpers/find-output-file-in-bucket.js +0 -38
- package/dist/functions/helpers/format-costs-info.d.ts +0 -2
- package/dist/functions/helpers/format-costs-info.js +0 -23
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +0 -10
- package/dist/functions/helpers/get-overall-progress-s3.js +0 -24
- package/dist/functions/helpers/get-overall-progress.d.ts +0 -9
- package/dist/functions/helpers/get-overall-progress.js +0 -23
- package/dist/functions/helpers/get-progress.d.ts +0 -15
- package/dist/functions/helpers/get-progress.js +0 -254
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
- package/dist/functions/helpers/get-retry-stats.js +0 -2
- package/dist/functions/helpers/inspect-errors.d.ts +0 -4
- package/dist/functions/helpers/inspect-errors.js +0 -39
- package/dist/functions/helpers/is-warm.d.ts +0 -2
- package/dist/functions/helpers/is-warm.js +0 -10
- package/dist/functions/helpers/leak-detection.d.ts +0 -4
- package/dist/functions/helpers/leak-detection.js +0 -40
- package/dist/functions/helpers/make-timeout-error.d.ts +0 -10
- package/dist/functions/helpers/make-timeout-error.js +0 -31
- package/dist/functions/helpers/make-timeout-message.d.ts +0 -10
- package/dist/functions/helpers/make-timeout-message.js +0 -75
- package/dist/functions/helpers/merge-chunks.d.ts +0 -36
- package/dist/functions/helpers/merge-chunks.js +0 -84
- package/dist/functions/helpers/min-max.d.ts +0 -2
- package/dist/functions/helpers/min-max.js +0 -33
- package/dist/functions/helpers/on-downloads-logger.d.ts +0 -2
- package/dist/functions/helpers/on-downloads-logger.js +0 -29
- package/dist/functions/helpers/overall-render-progress.d.ts +0 -59
- package/dist/functions/helpers/overall-render-progress.js +0 -180
- package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -1
- package/dist/functions/helpers/print-concurrency-curve.js +0 -8
- package/dist/functions/helpers/print-logging-helper.d.ts +0 -4
- package/dist/functions/helpers/print-logging-helper.js +0 -12
- package/dist/functions/helpers/render-has-audio-video.d.ts +0 -6
- package/dist/functions/helpers/render-has-audio-video.js +0 -21
- package/dist/functions/helpers/request-context.d.ts +0 -5
- package/dist/functions/helpers/request-context.js +0 -2
- package/dist/functions/helpers/stream-renderer.d.ts +0 -17
- package/dist/functions/helpers/stream-renderer.js +0 -148
- package/dist/functions/launch.d.ts +0 -10
- package/dist/functions/launch.js +0 -596
- package/dist/functions/progress.d.ts +0 -11
- package/dist/functions/progress.js +0 -51
- package/dist/functions/renderer.d.ts +0 -17
- package/dist/functions/renderer.js +0 -341
- package/dist/functions/start.d.ts +0 -13
- package/dist/functions/start.js +0 -113
- package/dist/functions/still.d.ts +0 -19
- package/dist/functions/still.js +0 -330
- package/dist/shared/__mocks__/aws-clients.d.ts +0 -2
- package/dist/shared/__mocks__/aws-clients.js +0 -62
- package/dist/shared/__mocks__/bundle-site.d.ts +0 -2
- package/dist/shared/__mocks__/bundle-site.js +0 -32
- package/dist/shared/__mocks__/check-credentials.d.ts +0 -1
- package/dist/shared/__mocks__/check-credentials.js +0 -5
- package/dist/shared/__mocks__/get-account-id.d.ts +0 -2
- package/dist/shared/__mocks__/get-account-id.js +0 -11
- package/dist/shared/__mocks__/read-dir.d.ts +0 -2
- package/dist/shared/__mocks__/read-dir.js +0 -13
- package/dist/shared/call-lambda.d.ts +0 -16
- package/dist/shared/cleanup-serialized-input-props.d.ts +0 -14
- package/dist/shared/cleanup-serialized-input-props.js +0 -34
- package/dist/shared/docs-url.d.ts +0 -1
- package/dist/shared/docs-url.js +0 -4
- package/dist/shared/get-most-expensive-chunks.d.ts +0 -8
- package/dist/shared/get-most-expensive-chunks.js +0 -28
- package/dist/shared/invoke-webhook.d.ts +0 -48
- package/dist/shared/invoke-webhook.js +0 -140
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -5
- package/dist/shared/parse-lambda-timings-key.js +0 -2
- package/dist/shared/return-values.d.ts +0 -16
- package/dist/shared/return-values.js +0 -2
- package/dist/shared/stackback.d.ts +0 -6
- package/dist/shared/stackback.js +0 -59
- package/dist/shared/validate-download-behavior.d.ts +0 -1
- package/dist/shared/validate-download-behavior.js +0 -21
- package/dist/shared/validate-frames-per-lambda.d.ts +0 -4
- package/dist/shared/validate-frames-per-lambda.js +0 -29
- package/dist/shared/validate-privacy.d.ts +0 -2
- package/dist/shared/validate-privacy.js +0 -14
- package/dist/shared/validate.d.ts +0 -4
- package/dist/shared/validate.js +0 -8
- package/dist/shared/why-is-node-running.d.ts +0 -15
- package/dist/shared/why-is-node-running.js +0 -88
- package/vitest.config.mts +0 -11
package/dist/functions/launch.js
DELETED
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.launchHandler = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const serverless_1 = require("@remotion/serverless");
|
|
6
|
-
const client_1 = require("@remotion/serverless/client");
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const version_1 = require("remotion/version");
|
|
10
|
-
const constants_1 = require("../shared/constants");
|
|
11
|
-
const docs_url_1 = require("../shared/docs-url");
|
|
12
|
-
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
13
|
-
const validate_1 = require("../shared/validate");
|
|
14
|
-
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
15
|
-
const validate_privacy_1 = require("../shared/validate-privacy");
|
|
16
|
-
const plan_frame_ranges_1 = require("./chunk-optimization/plan-frame-ranges");
|
|
17
|
-
const best_frames_per_lambda_param_1 = require("./helpers/best-frames-per-lambda-param");
|
|
18
|
-
const cleanup_props_1 = require("./helpers/cleanup-props");
|
|
19
|
-
const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-bucket");
|
|
20
|
-
const merge_chunks_1 = require("./helpers/merge-chunks");
|
|
21
|
-
const overall_render_progress_1 = require("./helpers/overall-render-progress");
|
|
22
|
-
const stream_renderer_1 = require("./helpers/stream-renderer");
|
|
23
|
-
const timer_1 = require("./helpers/timer");
|
|
24
|
-
const innerLaunchHandler = async ({ functionName, params, options, overallProgress, registerCleanupTask, providerSpecifics, }) => {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
|
-
if (params.type !== client_1.ServerlessRoutines.launch) {
|
|
27
|
-
throw new Error('Expected launch type');
|
|
28
|
-
}
|
|
29
|
-
const startedDate = Date.now();
|
|
30
|
-
const browserInstance = (0, serverless_1.getBrowserInstance)({
|
|
31
|
-
logLevel: params.logLevel,
|
|
32
|
-
indent: false,
|
|
33
|
-
chromiumOptions: params.chromiumOptions,
|
|
34
|
-
providerSpecifics,
|
|
35
|
-
});
|
|
36
|
-
const inputPropsPromise = (0, client_1.decompressInputProps)({
|
|
37
|
-
bucketName: params.bucketName,
|
|
38
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
39
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
40
|
-
serialized: params.inputProps,
|
|
41
|
-
propsType: 'input-props',
|
|
42
|
-
providerSpecifics,
|
|
43
|
-
forcePathStyle: params.forcePathStyle,
|
|
44
|
-
});
|
|
45
|
-
const logOptions = {
|
|
46
|
-
indent: false,
|
|
47
|
-
logLevel: params.logLevel,
|
|
48
|
-
};
|
|
49
|
-
const serializedInputPropsWithCustomSchema = await inputPropsPromise;
|
|
50
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'Waiting for browser to be ready:', serializedInputPropsWithCustomSchema);
|
|
51
|
-
const { instance } = await browserInstance;
|
|
52
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'Validating composition, input props:', serializedInputPropsWithCustomSchema);
|
|
53
|
-
const startTime = Date.now();
|
|
54
|
-
const comp = await (0, serverless_1.validateComposition)({
|
|
55
|
-
serveUrl: params.serveUrl,
|
|
56
|
-
composition: params.composition,
|
|
57
|
-
browserInstance: instance,
|
|
58
|
-
serializedInputPropsWithCustomSchema,
|
|
59
|
-
envVariables: (_a = params.envVariables) !== null && _a !== void 0 ? _a : {},
|
|
60
|
-
timeoutInMilliseconds: params.timeoutInMilliseconds,
|
|
61
|
-
chromiumOptions: params.chromiumOptions,
|
|
62
|
-
port: null,
|
|
63
|
-
forceHeight: params.forceHeight,
|
|
64
|
-
forceWidth: params.forceWidth,
|
|
65
|
-
logLevel: params.logLevel,
|
|
66
|
-
server: undefined,
|
|
67
|
-
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
|
|
68
|
-
onBrowserDownload: () => {
|
|
69
|
-
throw new Error('Should not download a browser in Lambda');
|
|
70
|
-
},
|
|
71
|
-
onServeUrlVisited: () => {
|
|
72
|
-
overallProgress.setServeUrlOpened(Date.now());
|
|
73
|
-
},
|
|
74
|
-
providerSpecifics,
|
|
75
|
-
});
|
|
76
|
-
overallProgress.setCompositionValidated(Date.now());
|
|
77
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'Composition validated, resolved props', comp.props);
|
|
78
|
-
(0, validate_1.validateDurationInFrames)(comp.durationInFrames, {
|
|
79
|
-
component: 'passed to a Lambda render',
|
|
80
|
-
allowFloats: false,
|
|
81
|
-
});
|
|
82
|
-
(0, validate_1.validateFps)(comp.fps, 'passed to a Lambda render', false);
|
|
83
|
-
(0, validate_1.validateDimension)(comp.height, 'height', 'passed to a Lambda render');
|
|
84
|
-
(0, validate_1.validateDimension)(comp.width, 'width', 'passed to a Lambda render');
|
|
85
|
-
renderer_1.RenderInternals.validateBitrate(params.audioBitrate, 'audioBitrate');
|
|
86
|
-
renderer_1.RenderInternals.validateBitrate(params.videoBitrate, 'videoBitrate');
|
|
87
|
-
renderer_1.RenderInternals.validateConcurrency({
|
|
88
|
-
value: params.concurrencyPerLambda,
|
|
89
|
-
setting: 'concurrencyPerLambda',
|
|
90
|
-
checkIfValidForCurrentMachine: ((_b = params.rendererFunctionName) !== null && _b !== void 0 ? _b : null) === null,
|
|
91
|
-
});
|
|
92
|
-
const realFrameRange = renderer_1.RenderInternals.getRealFrameRange(comp.durationInFrames, params.frameRange);
|
|
93
|
-
const frameCount = renderer_1.RenderInternals.getFramesToRender(realFrameRange, params.everyNthFrame);
|
|
94
|
-
const framesPerLambda = (_c = params.framesPerLambda) !== null && _c !== void 0 ? _c : (0, best_frames_per_lambda_param_1.bestFramesPerLambdaParam)(frameCount.length);
|
|
95
|
-
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({
|
|
96
|
-
framesPerLambda,
|
|
97
|
-
durationInFrames: frameCount.length,
|
|
98
|
-
});
|
|
99
|
-
(0, serverless_1.validateOutname)({
|
|
100
|
-
outName: params.outName,
|
|
101
|
-
codec: params.codec,
|
|
102
|
-
audioCodecSetting: params.audioCodec,
|
|
103
|
-
separateAudioTo: null,
|
|
104
|
-
});
|
|
105
|
-
(0, validate_privacy_1.validatePrivacy)(params.privacy, true);
|
|
106
|
-
renderer_1.RenderInternals.validatePuppeteerTimeout(params.timeoutInMilliseconds);
|
|
107
|
-
const { chunks } = (0, plan_frame_ranges_1.planFrameRanges)({
|
|
108
|
-
framesPerLambda,
|
|
109
|
-
frameRange: realFrameRange,
|
|
110
|
-
everyNthFrame: params.everyNthFrame,
|
|
111
|
-
});
|
|
112
|
-
if (chunks.length > constants_1.MAX_FUNCTIONS_PER_RENDER) {
|
|
113
|
-
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.length}, framesPerLambda=${framesPerLambda}. See ${docs_url_1.DOCS_URL}/docs/lambda/concurrency#too-many-functions for help.`);
|
|
114
|
-
}
|
|
115
|
-
overallProgress.setExpectedChunks(chunks.length);
|
|
116
|
-
const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
|
|
117
|
-
const serializedResolved = (0, client_1.serializeOrThrow)(comp.props, 'resolved-props');
|
|
118
|
-
const needsToUpload = (0, client_1.getNeedsToUpload)('video-or-audio', [
|
|
119
|
-
serializedResolved.length,
|
|
120
|
-
params.inputProps.type === 'bucket-url'
|
|
121
|
-
? params.inputProps.hash.length
|
|
122
|
-
: params.inputProps.payload.length,
|
|
123
|
-
JSON.stringify(params.envVariables).length,
|
|
124
|
-
]);
|
|
125
|
-
const serializedResolvedProps = await (0, client_1.compressInputProps)({
|
|
126
|
-
propsType: 'resolved-props',
|
|
127
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
128
|
-
stringifiedInputProps: serializedResolved,
|
|
129
|
-
userSpecifiedBucketName: params.bucketName,
|
|
130
|
-
needsToUpload,
|
|
131
|
-
providerSpecifics,
|
|
132
|
-
forcePathStyle: params.forcePathStyle,
|
|
133
|
-
skipPutAcl: false,
|
|
134
|
-
});
|
|
135
|
-
registerCleanupTask(() => {
|
|
136
|
-
return (0, cleanup_props_1.cleanupProps)({
|
|
137
|
-
serializedResolvedProps,
|
|
138
|
-
inputProps: params.inputProps,
|
|
139
|
-
providerSpecifics,
|
|
140
|
-
forcePathStyle: params.forcePathStyle,
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
const fps = comp.fps / params.everyNthFrame;
|
|
144
|
-
// If for 150 functions, we stream every frame, we DDos ourselves.
|
|
145
|
-
// Throttling a bit, allowing more progress if there is lower concurrency.
|
|
146
|
-
const progressEveryNthFrame = Math.ceil(chunks.length / 15);
|
|
147
|
-
const lambdaPayloads = chunks.map((chunkPayload) => {
|
|
148
|
-
var _a;
|
|
149
|
-
const payload = {
|
|
150
|
-
type: client_1.ServerlessRoutines.renderer,
|
|
151
|
-
frameRange: chunkPayload,
|
|
152
|
-
serveUrl: params.serveUrl,
|
|
153
|
-
chunk: sortedChunks.indexOf(chunkPayload),
|
|
154
|
-
composition: params.composition,
|
|
155
|
-
fps: comp.fps,
|
|
156
|
-
height: comp.height,
|
|
157
|
-
width: comp.width,
|
|
158
|
-
durationInFrames: comp.durationInFrames,
|
|
159
|
-
bucketName: params.bucketName,
|
|
160
|
-
retriesLeft: params.maxRetries,
|
|
161
|
-
inputProps: params.inputProps,
|
|
162
|
-
renderId: params.renderId,
|
|
163
|
-
imageFormat: params.imageFormat,
|
|
164
|
-
codec: params.codec,
|
|
165
|
-
crf: params.crf,
|
|
166
|
-
envVariables: params.envVariables,
|
|
167
|
-
pixelFormat: params.pixelFormat,
|
|
168
|
-
proResProfile: params.proResProfile,
|
|
169
|
-
x264Preset: params.x264Preset,
|
|
170
|
-
jpegQuality: params.jpegQuality,
|
|
171
|
-
privacy: params.privacy,
|
|
172
|
-
logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
|
|
173
|
-
attempt: 1,
|
|
174
|
-
timeoutInMilliseconds: params.timeoutInMilliseconds,
|
|
175
|
-
chromiumOptions: params.chromiumOptions,
|
|
176
|
-
scale: params.scale,
|
|
177
|
-
everyNthFrame: params.everyNthFrame,
|
|
178
|
-
concurrencyPerLambda: params.concurrencyPerLambda,
|
|
179
|
-
muted: params.muted,
|
|
180
|
-
audioBitrate: params.audioBitrate,
|
|
181
|
-
videoBitrate: params.videoBitrate,
|
|
182
|
-
encodingMaxRate: params.encodingMaxRate,
|
|
183
|
-
encodingBufferSize: params.encodingBufferSize,
|
|
184
|
-
launchFunctionConfig: {
|
|
185
|
-
version: version_1.VERSION,
|
|
186
|
-
},
|
|
187
|
-
resolvedProps: serializedResolvedProps,
|
|
188
|
-
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
|
|
189
|
-
deleteAfter: params.deleteAfter,
|
|
190
|
-
colorSpace: params.colorSpace,
|
|
191
|
-
preferLossless: params.preferLossless,
|
|
192
|
-
compositionStart: realFrameRange[0],
|
|
193
|
-
framesPerLambda,
|
|
194
|
-
progressEveryNthFrame,
|
|
195
|
-
forcePathStyle: params.forcePathStyle,
|
|
196
|
-
metadata: params.metadata,
|
|
197
|
-
};
|
|
198
|
-
return payload;
|
|
199
|
-
});
|
|
200
|
-
renderer_1.RenderInternals.Log.info(logOptions, 'Render plan: ', chunks.map((c, i) => `Chunk ${i} (Frames ${c[0]} - ${c[1]})`).join(', '));
|
|
201
|
-
const renderMetadata = {
|
|
202
|
-
startedDate,
|
|
203
|
-
totalChunks: chunks.length,
|
|
204
|
-
estimatedTotalLambdaInvokations: [
|
|
205
|
-
// Direct invokations
|
|
206
|
-
chunks.length,
|
|
207
|
-
// This function
|
|
208
|
-
1,
|
|
209
|
-
].reduce((a, b) => a + b, 0),
|
|
210
|
-
estimatedRenderLambdaInvokations: chunks.length,
|
|
211
|
-
compositionId: comp.id,
|
|
212
|
-
siteId: params.serveUrl,
|
|
213
|
-
codec: params.codec,
|
|
214
|
-
type: 'video',
|
|
215
|
-
imageFormat: params.imageFormat,
|
|
216
|
-
inputProps: params.inputProps,
|
|
217
|
-
lambdaVersion: version_1.VERSION,
|
|
218
|
-
framesPerLambda,
|
|
219
|
-
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
220
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
221
|
-
renderId: params.renderId,
|
|
222
|
-
outName: (_d = params.outName) !== null && _d !== void 0 ? _d : undefined,
|
|
223
|
-
privacy: params.privacy,
|
|
224
|
-
everyNthFrame: params.everyNthFrame,
|
|
225
|
-
frameRange: realFrameRange,
|
|
226
|
-
audioCodec: params.audioCodec,
|
|
227
|
-
deleteAfter: params.deleteAfter,
|
|
228
|
-
numberOfGifLoops: params.numberOfGifLoops,
|
|
229
|
-
downloadBehavior: params.downloadBehavior,
|
|
230
|
-
audioBitrate: params.audioBitrate,
|
|
231
|
-
muted: params.muted,
|
|
232
|
-
metadata: params.metadata,
|
|
233
|
-
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
234
|
-
dimensions: {
|
|
235
|
-
width: comp.width * ((_e = params.scale) !== null && _e !== void 0 ? _e : 1),
|
|
236
|
-
height: comp.height * ((_f = params.scale) !== null && _f !== void 0 ? _f : 1),
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
const { key, renderBucketName, customCredentials } = (0, client_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
240
|
-
? null
|
|
241
|
-
: ((_h = (_g = params.outName) === null || _g === void 0 ? void 0 : _g.s3OutputProvider) !== null && _h !== void 0 ? _h : null));
|
|
242
|
-
if (!params.overwrite) {
|
|
243
|
-
const findOutputFile = (0, timer_1.timer)('Checking if output file already exists', params.logLevel);
|
|
244
|
-
const output = await (0, find_output_file_in_bucket_1.findOutputFileInBucket)({
|
|
245
|
-
bucketName: params.bucketName,
|
|
246
|
-
customCredentials,
|
|
247
|
-
renderMetadata,
|
|
248
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
249
|
-
currentRegion: providerSpecifics.getCurrentRegionInFunction(),
|
|
250
|
-
providerSpecifics,
|
|
251
|
-
forcePathStyle: params.forcePathStyle,
|
|
252
|
-
});
|
|
253
|
-
if (output) {
|
|
254
|
-
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${providerSpecifics.getCurrentRegionInFunction()}" already exists. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda() to overwrite it."`);
|
|
255
|
-
}
|
|
256
|
-
findOutputFile.end();
|
|
257
|
-
}
|
|
258
|
-
overallProgress.setRenderMetadata(renderMetadata);
|
|
259
|
-
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
260
|
-
if ((0, fs_1.existsSync)(outdir)) {
|
|
261
|
-
(0, fs_1.rmSync)(outdir, {
|
|
262
|
-
recursive: true,
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
(0, fs_1.mkdirSync)(outdir);
|
|
266
|
-
const files = [];
|
|
267
|
-
const onArtifact = (artifact) => {
|
|
268
|
-
if (overallProgress
|
|
269
|
-
.getReceivedArtifacts()
|
|
270
|
-
.find((a) => a.filename === artifact.filename)) {
|
|
271
|
-
return { alreadyExisted: true };
|
|
272
|
-
}
|
|
273
|
-
const region = providerSpecifics.getCurrentRegionInFunction();
|
|
274
|
-
const storageKey = (0, client_1.artifactName)(renderMetadata.renderId, artifact.filename);
|
|
275
|
-
const start = Date.now();
|
|
276
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'Writing artifact ' + artifact.filename + ' to S3');
|
|
277
|
-
providerSpecifics
|
|
278
|
-
.writeFile({
|
|
279
|
-
bucketName: renderBucketName,
|
|
280
|
-
key: storageKey,
|
|
281
|
-
body: artifact.content,
|
|
282
|
-
region,
|
|
283
|
-
privacy: params.privacy,
|
|
284
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
285
|
-
downloadBehavior: params.downloadBehavior,
|
|
286
|
-
customCredentials,
|
|
287
|
-
forcePathStyle: params.forcePathStyle,
|
|
288
|
-
})
|
|
289
|
-
.then(() => {
|
|
290
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, `Wrote artifact to S3 in ${Date.now() - start}ms`);
|
|
291
|
-
overallProgress.addReceivedArtifact(providerSpecifics.makeArtifactWithDetails({
|
|
292
|
-
region,
|
|
293
|
-
renderBucketName,
|
|
294
|
-
storageKey,
|
|
295
|
-
artifact,
|
|
296
|
-
}));
|
|
297
|
-
})
|
|
298
|
-
.catch((err) => {
|
|
299
|
-
overallProgress.addErrorWithoutUpload({
|
|
300
|
-
type: 'artifact',
|
|
301
|
-
message: err.message,
|
|
302
|
-
name: err.name,
|
|
303
|
-
stack: err.stack,
|
|
304
|
-
tmpDir: null,
|
|
305
|
-
frame: artifact.frame,
|
|
306
|
-
chunk: null,
|
|
307
|
-
isFatal: false,
|
|
308
|
-
attempt: 1,
|
|
309
|
-
willRetry: false,
|
|
310
|
-
totalAttempts: 1,
|
|
311
|
-
});
|
|
312
|
-
overallProgress.upload();
|
|
313
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to write artifact to S3', err);
|
|
314
|
-
});
|
|
315
|
-
return { alreadyExisted: false };
|
|
316
|
-
};
|
|
317
|
-
await Promise.all(lambdaPayloads.map(async (payload) => {
|
|
318
|
-
await (0, stream_renderer_1.streamRendererFunctionWithRetry)({
|
|
319
|
-
files,
|
|
320
|
-
functionName,
|
|
321
|
-
outdir,
|
|
322
|
-
overallProgress,
|
|
323
|
-
payload,
|
|
324
|
-
logLevel: params.logLevel,
|
|
325
|
-
onArtifact,
|
|
326
|
-
providerSpecifics,
|
|
327
|
-
});
|
|
328
|
-
}));
|
|
329
|
-
const postRenderData = await (0, merge_chunks_1.mergeChunksAndFinishRender)({
|
|
330
|
-
bucketName: params.bucketName,
|
|
331
|
-
renderId: params.renderId,
|
|
332
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
333
|
-
numberOfFrames: frameCount.length,
|
|
334
|
-
audioCodec: params.audioCodec,
|
|
335
|
-
chunkCount: chunks.length,
|
|
336
|
-
codec: params.codec,
|
|
337
|
-
customCredentials,
|
|
338
|
-
downloadBehavior: params.downloadBehavior,
|
|
339
|
-
fps,
|
|
340
|
-
key,
|
|
341
|
-
numberOfGifLoops: params.numberOfGifLoops,
|
|
342
|
-
privacy: params.privacy,
|
|
343
|
-
renderBucketName,
|
|
344
|
-
inputProps: params.inputProps,
|
|
345
|
-
serializedResolvedProps,
|
|
346
|
-
renderMetadata,
|
|
347
|
-
audioBitrate: params.audioBitrate,
|
|
348
|
-
logLevel: params.logLevel,
|
|
349
|
-
framesPerLambda,
|
|
350
|
-
binariesDirectory: null,
|
|
351
|
-
preferLossless: params.preferLossless,
|
|
352
|
-
compositionStart: realFrameRange[0],
|
|
353
|
-
outdir,
|
|
354
|
-
files: files.sort(),
|
|
355
|
-
overallProgress,
|
|
356
|
-
startTime,
|
|
357
|
-
providerSpecifics,
|
|
358
|
-
forcePathStyle: params.forcePathStyle,
|
|
359
|
-
});
|
|
360
|
-
return postRenderData;
|
|
361
|
-
};
|
|
362
|
-
const launchHandler = async (params, options, providerSpecifics) => {
|
|
363
|
-
var _a, _b, _c;
|
|
364
|
-
if (params.type !== client_1.ServerlessRoutines.launch) {
|
|
365
|
-
throw new Error('Expected launch type');
|
|
366
|
-
}
|
|
367
|
-
const functionName = (_a = params.rendererFunctionName) !== null && _a !== void 0 ? _a : process.env.AWS_LAMBDA_FUNCTION_NAME;
|
|
368
|
-
const logOptions = {
|
|
369
|
-
indent: false,
|
|
370
|
-
logLevel: params.logLevel,
|
|
371
|
-
};
|
|
372
|
-
const cleanupTasks = [];
|
|
373
|
-
const registerCleanupTask = (task) => {
|
|
374
|
-
cleanupTasks.push(task);
|
|
375
|
-
};
|
|
376
|
-
const runCleanupTasks = () => {
|
|
377
|
-
const prom = Promise.all(cleanupTasks)
|
|
378
|
-
.then(() => {
|
|
379
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'Ran cleanup tasks');
|
|
380
|
-
})
|
|
381
|
-
.catch((err) => {
|
|
382
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to run cleanup tasks:', err);
|
|
383
|
-
});
|
|
384
|
-
cleanupTasks.length = 0;
|
|
385
|
-
return prom;
|
|
386
|
-
};
|
|
387
|
-
const onTimeout = async () => {
|
|
388
|
-
var _a;
|
|
389
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Function is about to time out. Can not finish render.');
|
|
390
|
-
// @ts-expect-error - We are adding a listener to a global variable
|
|
391
|
-
if (globalThis._dumpUnreleasedBuffers) {
|
|
392
|
-
// @ts-expect-error - We are adding a listener to a global variable
|
|
393
|
-
globalThis._dumpUnreleasedBuffers.emit('dump-unreleased-buffers');
|
|
394
|
-
}
|
|
395
|
-
runCleanupTasks();
|
|
396
|
-
if (!params.webhook) {
|
|
397
|
-
renderer_1.RenderInternals.Log.verbose({
|
|
398
|
-
indent: false,
|
|
399
|
-
logLevel: params.logLevel,
|
|
400
|
-
}, 'No webhook specified.');
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
if (webhookInvoked) {
|
|
404
|
-
renderer_1.RenderInternals.Log.verbose({
|
|
405
|
-
indent: false,
|
|
406
|
-
logLevel: params.logLevel,
|
|
407
|
-
}, 'Webhook already invoked. Not invoking again.');
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
try {
|
|
411
|
-
await (0, invoke_webhook_1.invokeWebhook)({
|
|
412
|
-
url: params.webhook.url,
|
|
413
|
-
secret: params.webhook.secret,
|
|
414
|
-
payload: {
|
|
415
|
-
type: 'timeout',
|
|
416
|
-
renderId: params.renderId,
|
|
417
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
418
|
-
bucketName: params.bucketName,
|
|
419
|
-
customData: (_a = params.webhook.customData) !== null && _a !== void 0 ? _a : null,
|
|
420
|
-
},
|
|
421
|
-
redirectsSoFar: 0,
|
|
422
|
-
}, params.logLevel);
|
|
423
|
-
renderer_1.RenderInternals.Log.verbose({
|
|
424
|
-
indent: false,
|
|
425
|
-
logLevel: params.logLevel,
|
|
426
|
-
}, 'Successfully invoked timeout webhook.', params.webhook.url);
|
|
427
|
-
webhookInvoked = true;
|
|
428
|
-
}
|
|
429
|
-
catch (err) {
|
|
430
|
-
if (process.env.NODE_ENV === 'test') {
|
|
431
|
-
throw err;
|
|
432
|
-
}
|
|
433
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
434
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, err);
|
|
435
|
-
overallProgress.addErrorWithoutUpload({
|
|
436
|
-
type: 'webhook',
|
|
437
|
-
message: err.message,
|
|
438
|
-
name: err.name,
|
|
439
|
-
stack: err.stack,
|
|
440
|
-
tmpDir: null,
|
|
441
|
-
frame: 0,
|
|
442
|
-
chunk: 0,
|
|
443
|
-
isFatal: false,
|
|
444
|
-
attempt: 1,
|
|
445
|
-
willRetry: false,
|
|
446
|
-
totalAttempts: 1,
|
|
447
|
-
});
|
|
448
|
-
overallProgress.upload();
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
let webhookInvoked = false;
|
|
452
|
-
const webhookDueToTimeout = setTimeout(onTimeout, Math.max(options.getRemainingTimeInMillis() - 1000, 1000));
|
|
453
|
-
renderer_1.RenderInternals.Log.info(logOptions, `Function has ${Math.max(options.getRemainingTimeInMillis() - 1000, 1000)} before it times out`);
|
|
454
|
-
const overallProgress = (0, overall_render_progress_1.makeOverallRenderProgress)({
|
|
455
|
-
renderId: params.renderId,
|
|
456
|
-
bucketName: params.bucketName,
|
|
457
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
458
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
459
|
-
timeoutTimestamp: options.getRemainingTimeInMillis() + Date.now(),
|
|
460
|
-
logLevel: params.logLevel,
|
|
461
|
-
providerSpecifics,
|
|
462
|
-
forcePathStyle: params.forcePathStyle,
|
|
463
|
-
});
|
|
464
|
-
try {
|
|
465
|
-
const postRenderData = await innerLaunchHandler({
|
|
466
|
-
functionName,
|
|
467
|
-
params,
|
|
468
|
-
options,
|
|
469
|
-
overallProgress,
|
|
470
|
-
registerCleanupTask,
|
|
471
|
-
providerSpecifics,
|
|
472
|
-
});
|
|
473
|
-
clearTimeout(webhookDueToTimeout);
|
|
474
|
-
if (!params.webhook || webhookInvoked) {
|
|
475
|
-
return {
|
|
476
|
-
type: 'success',
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
try {
|
|
480
|
-
await (0, invoke_webhook_1.invokeWebhook)({
|
|
481
|
-
url: params.webhook.url,
|
|
482
|
-
secret: params.webhook.secret,
|
|
483
|
-
payload: {
|
|
484
|
-
type: 'success',
|
|
485
|
-
renderId: params.renderId,
|
|
486
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
487
|
-
bucketName: params.bucketName,
|
|
488
|
-
customData: (_b = params.webhook.customData) !== null && _b !== void 0 ? _b : null,
|
|
489
|
-
outputUrl: postRenderData.outputFile,
|
|
490
|
-
lambdaErrors: postRenderData.errors,
|
|
491
|
-
outputFile: postRenderData.outputFile,
|
|
492
|
-
timeToFinish: postRenderData.timeToFinish,
|
|
493
|
-
costs: postRenderData.cost,
|
|
494
|
-
},
|
|
495
|
-
redirectsSoFar: 0,
|
|
496
|
-
}, params.logLevel);
|
|
497
|
-
webhookInvoked = true;
|
|
498
|
-
}
|
|
499
|
-
catch (err) {
|
|
500
|
-
if (process.env.NODE_ENV === 'test') {
|
|
501
|
-
throw err;
|
|
502
|
-
}
|
|
503
|
-
overallProgress.addErrorWithoutUpload({
|
|
504
|
-
type: 'webhook',
|
|
505
|
-
message: err.message,
|
|
506
|
-
name: err.name,
|
|
507
|
-
stack: err.stack,
|
|
508
|
-
tmpDir: null,
|
|
509
|
-
frame: 0,
|
|
510
|
-
chunk: 0,
|
|
511
|
-
isFatal: false,
|
|
512
|
-
attempt: 1,
|
|
513
|
-
willRetry: false,
|
|
514
|
-
totalAttempts: 1,
|
|
515
|
-
});
|
|
516
|
-
overallProgress.upload();
|
|
517
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
518
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, err);
|
|
519
|
-
}
|
|
520
|
-
runCleanupTasks();
|
|
521
|
-
return {
|
|
522
|
-
type: 'success',
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
catch (err) {
|
|
526
|
-
if (process.env.NODE_ENV === 'test') {
|
|
527
|
-
throw err;
|
|
528
|
-
}
|
|
529
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Error occurred', err);
|
|
530
|
-
overallProgress.addErrorWithoutUpload({
|
|
531
|
-
chunk: null,
|
|
532
|
-
frame: null,
|
|
533
|
-
name: err.name,
|
|
534
|
-
stack: err.stack,
|
|
535
|
-
type: 'stitcher',
|
|
536
|
-
isFatal: true,
|
|
537
|
-
tmpDir: (0, serverless_1.getTmpDirStateIfENoSp)(err.stack, providerSpecifics),
|
|
538
|
-
attempt: 1,
|
|
539
|
-
totalAttempts: 1,
|
|
540
|
-
willRetry: false,
|
|
541
|
-
message: err.message,
|
|
542
|
-
});
|
|
543
|
-
await overallProgress.upload();
|
|
544
|
-
runCleanupTasks();
|
|
545
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Wrote error to S3');
|
|
546
|
-
clearTimeout(webhookDueToTimeout);
|
|
547
|
-
if (params.webhook && !webhookInvoked) {
|
|
548
|
-
try {
|
|
549
|
-
await (0, invoke_webhook_1.invokeWebhook)({
|
|
550
|
-
url: params.webhook.url,
|
|
551
|
-
secret: params.webhook.secret,
|
|
552
|
-
payload: {
|
|
553
|
-
type: 'error',
|
|
554
|
-
renderId: params.renderId,
|
|
555
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
556
|
-
bucketName: params.bucketName,
|
|
557
|
-
customData: (_c = params.webhook.customData) !== null && _c !== void 0 ? _c : null,
|
|
558
|
-
errors: [err].map((e) => ({
|
|
559
|
-
message: e.message,
|
|
560
|
-
name: e.name,
|
|
561
|
-
stack: e.stack,
|
|
562
|
-
})),
|
|
563
|
-
},
|
|
564
|
-
redirectsSoFar: 0,
|
|
565
|
-
}, params.logLevel);
|
|
566
|
-
webhookInvoked = true;
|
|
567
|
-
}
|
|
568
|
-
catch (error) {
|
|
569
|
-
if (process.env.NODE_ENV === 'test') {
|
|
570
|
-
throw error;
|
|
571
|
-
}
|
|
572
|
-
overallProgress.addErrorWithoutUpload({
|
|
573
|
-
type: 'webhook',
|
|
574
|
-
message: err.message,
|
|
575
|
-
name: err.name,
|
|
576
|
-
stack: err.stack,
|
|
577
|
-
tmpDir: null,
|
|
578
|
-
frame: 0,
|
|
579
|
-
chunk: 0,
|
|
580
|
-
isFatal: false,
|
|
581
|
-
attempt: 1,
|
|
582
|
-
willRetry: false,
|
|
583
|
-
totalAttempts: 1,
|
|
584
|
-
});
|
|
585
|
-
overallProgress.upload();
|
|
586
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to invoke webhook:');
|
|
587
|
-
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, error);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
throw err;
|
|
591
|
-
}
|
|
592
|
-
finally {
|
|
593
|
-
(0, serverless_1.forgetBrowserEventLoop)(params.logLevel);
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
exports.launchHandler = launchHandler;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
-
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
3
|
-
import type { GenericRenderProgress } from '../shared/constants';
|
|
4
|
-
type Options<Provider extends CloudProvider> = {
|
|
5
|
-
expectedBucketOwner: string;
|
|
6
|
-
timeoutInMilliseconds: number;
|
|
7
|
-
retriesRemaining: number;
|
|
8
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
9
|
-
};
|
|
10
|
-
export declare const progressHandler: <Provider extends CloudProvider>(lambdaParams: ServerlessPayload<Provider>, options: Options<Provider>) => Promise<GenericRenderProgress<Provider>>;
|
|
11
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.progressHandler = void 0;
|
|
4
|
-
const client_1 = require("@remotion/serverless/client");
|
|
5
|
-
const version_1 = require("remotion/version");
|
|
6
|
-
const get_progress_1 = require("./helpers/get-progress");
|
|
7
|
-
const progressHandler = async (lambdaParams, options) => {
|
|
8
|
-
var _a;
|
|
9
|
-
if (lambdaParams.type !== client_1.ServerlessRoutines.status) {
|
|
10
|
-
throw new TypeError('Expected status type');
|
|
11
|
-
}
|
|
12
|
-
if (lambdaParams.version !== version_1.VERSION) {
|
|
13
|
-
if (!lambdaParams.version) {
|
|
14
|
-
throw new Error(`Version mismatch: When calling getRenderProgress(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getRenderProgress(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
15
|
-
}
|
|
16
|
-
throw new Error(`Version mismatch: When calling getRenderProgress(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getRenderProgress(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const progress = await (0, get_progress_1.getProgress)({
|
|
20
|
-
bucketName: lambdaParams.bucketName,
|
|
21
|
-
renderId: lambdaParams.renderId,
|
|
22
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
23
|
-
region: options.providerSpecifics.getCurrentRegionInFunction(),
|
|
24
|
-
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
25
|
-
timeoutInMilliseconds: options.timeoutInMilliseconds,
|
|
26
|
-
customCredentials: (_a = lambdaParams.s3OutputProvider) !== null && _a !== void 0 ? _a : null,
|
|
27
|
-
providerSpecifics: options.providerSpecifics,
|
|
28
|
-
forcePathStyle: lambdaParams.forcePathStyle,
|
|
29
|
-
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
30
|
-
});
|
|
31
|
-
return progress;
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
if (options.retriesRemaining === 0) {
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
if (err.message.includes('No render with ID')) {
|
|
38
|
-
await new Promise((resolve) => {
|
|
39
|
-
setTimeout(resolve, 1000);
|
|
40
|
-
});
|
|
41
|
-
return (0, exports.progressHandler)(lambdaParams, {
|
|
42
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
43
|
-
timeoutInMilliseconds: options.timeoutInMilliseconds,
|
|
44
|
-
retriesRemaining: options.retriesRemaining - 1,
|
|
45
|
-
providerSpecifics: options.providerSpecifics,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
throw err;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
exports.progressHandler = progressHandler;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { CloudProvider, OnStream, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
-
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
3
|
-
import type { RequestContext } from './helpers/request-context';
|
|
4
|
-
type Options = {
|
|
5
|
-
expectedBucketOwner: string;
|
|
6
|
-
isWarm: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const rendererHandler: <Provider extends CloudProvider>({ onStream, options, params, providerSpecifics, requestContext, }: {
|
|
9
|
-
params: ServerlessPayload<Provider>;
|
|
10
|
-
options: Options;
|
|
11
|
-
onStream: OnStream<Provider>;
|
|
12
|
-
requestContext: RequestContext;
|
|
13
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
14
|
-
}) => Promise<{
|
|
15
|
-
type: "success";
|
|
16
|
-
}>;
|
|
17
|
-
export {};
|