@remotion/lambda 4.0.0-copy.4 → 4.0.0-esm.17
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/bundle-lambda.js +20 -4
- package/dist/admin/generate-etag-list.d.ts +1 -0
- package/dist/admin/generate-etag-list.js +14 -0
- package/dist/admin/make-layer-public.js +23 -1
- package/dist/api/deploy-function.js +3 -1
- package/dist/api/deploy-site.d.ts +5 -0
- package/dist/api/deploy-site.js +39 -21
- package/dist/api/get-aws-client.d.ts +2 -0
- package/dist/api/get-aws-client.js +2 -0
- package/dist/api/get-buckets.js +26 -9
- package/dist/api/get-compositions-on-lambda.d.ts +2 -1
- package/dist/api/get-compositions-on-lambda.js +1 -3
- package/dist/api/get-or-create-bucket.js +2 -7
- package/dist/api/get-regions.d.ts +5 -1
- package/dist/api/get-regions.js +5 -2
- package/dist/api/iam-validation/simulate-rule.js +0 -22
- package/dist/api/iam-validation/simulate.js +24 -5
- package/dist/api/iam-validation/user-permissions.js +0 -8
- package/dist/api/render-media-on-lambda.d.ts +2 -1
- package/dist/api/render-media-on-lambda.js +6 -10
- package/dist/api/render-still-on-lambda.d.ts +2 -1
- package/dist/api/render-still-on-lambda.js +1 -3
- package/dist/api/upload-dir.d.ts +4 -3
- package/dist/api/upload-dir.js +33 -19
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/commands/compositions/index.js +1 -3
- package/dist/cli/commands/regions.js +5 -1
- package/dist/cli/commands/render/progress.d.ts +6 -3
- package/dist/cli/commands/render/progress.js +49 -39
- package/dist/cli/commands/render/render.js +17 -4
- package/dist/cli/commands/sites/create.js +12 -4
- package/dist/cli/commands/still.js +5 -9
- package/dist/cli/helpers/progress-bar.d.ts +9 -3
- package/dist/cli/helpers/progress-bar.js +19 -3
- package/dist/cli/index.js +6 -1
- package/dist/functions/compositions.js +10 -3
- package/dist/functions/helpers/concat-videos.d.ts +10 -6
- package/dist/functions/helpers/concat-videos.js +8 -25
- package/dist/functions/helpers/create-post-render-data.js +0 -12
- package/dist/functions/helpers/expected-out-name.js +1 -1
- package/dist/functions/helpers/get-chromium-executable-path.js +2 -1
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-metadata.d.ts +4 -8
- package/dist/functions/helpers/get-encoding-metadata.js +4 -18
- package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
- package/dist/functions/helpers/get-final-encoding-status.js +1 -4
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -5
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
- package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
- package/dist/functions/helpers/get-overall-progress.js +7 -5
- package/dist/functions/helpers/get-progress.js +40 -26
- package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
- package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
- package/dist/functions/launch.js +50 -38
- package/dist/functions/renderer.js +19 -24
- package/dist/functions/start.js +9 -2
- package/dist/functions/still.js +16 -5
- package/dist/index.d.ts +9 -2
- package/dist/index.js +10 -2
- package/dist/pricing/aws-regions.d.ts +2 -1
- package/dist/pricing/aws-regions.js +31 -1
- package/dist/pricing/price-per-1-s.js +413 -39
- package/dist/shared/aws-clients.d.ts +3 -0
- package/dist/shared/aws-clients.js +75 -13
- package/dist/shared/check-credentials.js +3 -0
- package/dist/shared/chunk-progress.d.ts +9 -0
- package/dist/shared/chunk-progress.js +2034 -0
- package/dist/shared/constants.d.ts +13 -12
- package/dist/shared/convert-to-serve-url.d.ts +5 -1
- package/dist/shared/convert-to-serve-url.js +1 -5
- package/dist/shared/deserialize-input-props.d.ts +1 -1
- package/dist/shared/deserialize-input-props.js +1 -1
- package/dist/shared/function-zip-path.d.ts +2 -1
- package/dist/shared/function-zip-path.js +3 -2
- package/dist/shared/get-account-id.js +4 -6
- package/dist/shared/get-etag.d.ts +1 -0
- package/dist/shared/get-etag.js +24 -0
- package/dist/shared/get-s3-operations.d.ts +10 -0
- package/dist/shared/get-s3-operations.js +36 -0
- package/dist/shared/hosted-layers.js +368 -60
- package/dist/shared/invoke-webhook.d.ts +2 -0
- package/dist/shared/parse-chunk-key.d.ts +4 -0
- package/dist/shared/parse-chunk-key.js +14 -0
- package/dist/shared/read-dir.d.ts +9 -0
- package/dist/shared/read-dir.js +57 -0
- package/dist/shared/validate-bucketname.d.ts +5 -0
- package/dist/shared/validate-bucketname.js +19 -1
- package/dist/shared/validate-lambda-codec.d.ts +1 -1
- package/dist/shared/validate-lambda-codec.js +0 -1
- package/package.json +18 -14
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
- package/remotionlambda.zip +0 -0
- package/.prettierrc.js +0 -14
- package/dist/api/enable-s3-website.d.ts +0 -5
- package/dist/api/enable-s3-website.js +0 -16
- package/dist/shared/get-cloudwatch-stream-url.d.ts +0 -8
- package/dist/shared/get-cloudwatch-stream-url.js +0 -7
- package/tsconfig.json +0 -16
package/dist/functions/launch.js
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.launchHandler = void 0;
|
|
7
27
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
28
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const fs_1 =
|
|
29
|
+
const fs_1 = __importStar(require("fs"));
|
|
30
|
+
const path_1 = require("path");
|
|
10
31
|
const remotion_1 = require("remotion");
|
|
11
32
|
const version_1 = require("remotion/version");
|
|
12
33
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
@@ -29,7 +50,6 @@ const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-buck
|
|
|
29
50
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
30
51
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
31
52
|
const get_files_to_delete_1 = require("./helpers/get-files-to-delete");
|
|
32
|
-
const get_lambdas_invoked_stats_1 = require("./helpers/get-lambdas-invoked-stats");
|
|
33
53
|
const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-metadata");
|
|
34
54
|
const inspect_errors_1 = require("./helpers/inspect-errors");
|
|
35
55
|
const io_1 = require("./helpers/io");
|
|
@@ -178,7 +198,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
178
198
|
inputProps: params.inputProps,
|
|
179
199
|
renderId: params.renderId,
|
|
180
200
|
imageFormat: params.imageFormat,
|
|
181
|
-
codec: params.codec
|
|
201
|
+
codec: params.codec,
|
|
182
202
|
crf: params.crf,
|
|
183
203
|
envVariables: params.envVariables,
|
|
184
204
|
pixelFormat: params.pixelFormat,
|
|
@@ -223,6 +243,8 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
223
243
|
renderId: params.renderId,
|
|
224
244
|
outName: (_b = params.outName) !== null && _b !== void 0 ? _b : undefined,
|
|
225
245
|
privacy: params.privacy,
|
|
246
|
+
everyNthFrame: params.everyNthFrame,
|
|
247
|
+
frameRange: realFrameRange,
|
|
226
248
|
};
|
|
227
249
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
228
250
|
? null
|
|
@@ -264,27 +286,17 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
264
286
|
}));
|
|
265
287
|
reqSend.end();
|
|
266
288
|
let lastProgressUploaded = 0;
|
|
267
|
-
|
|
268
|
-
const onProgress = (framesEncoded, start) => {
|
|
289
|
+
const onProgress = (framesEncoded) => {
|
|
269
290
|
const relativeProgress = framesEncoded / frameCount.length;
|
|
270
291
|
const deltaSinceLastProgressUploaded = relativeProgress - lastProgressUploaded;
|
|
271
|
-
if (relativeProgress === 1) {
|
|
272
|
-
encodingStop = Date.now();
|
|
273
|
-
}
|
|
274
292
|
if (deltaSinceLastProgressUploaded < 0.1) {
|
|
275
293
|
return;
|
|
276
294
|
}
|
|
277
295
|
lastProgressUploaded = relativeProgress;
|
|
278
|
-
const encodingProgress = {
|
|
279
|
-
framesEncoded,
|
|
280
|
-
totalFrames: frameCount.length,
|
|
281
|
-
doneIn: encodingStop ? encodingStop - start : null,
|
|
282
|
-
timeToInvoke: null,
|
|
283
|
-
};
|
|
284
296
|
(0, io_1.lambdaWriteFile)({
|
|
285
297
|
bucketName: params.bucketName,
|
|
286
298
|
key: (0, constants_1.encodingProgressKey)(params.renderId),
|
|
287
|
-
body:
|
|
299
|
+
body: String(framesEncoded),
|
|
288
300
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
289
301
|
privacy: 'private',
|
|
290
302
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -338,24 +350,35 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
338
350
|
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
339
351
|
};
|
|
340
352
|
const fps = comp.fps / params.everyNthFrame;
|
|
341
|
-
const
|
|
353
|
+
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
354
|
+
if ((0, fs_1.existsSync)(outdir)) {
|
|
355
|
+
(fs_1.rmSync !== null && fs_1.rmSync !== void 0 ? fs_1.rmSync : fs_1.rmdirSync)(outdir, {
|
|
356
|
+
recursive: true,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
(0, fs_1.mkdirSync)(outdir);
|
|
360
|
+
const files = await (0, concat_videos_1.getAllFilesS3)({
|
|
342
361
|
bucket: params.bucketName,
|
|
343
362
|
expectedFiles: chunkCount,
|
|
344
|
-
|
|
345
|
-
numberOfFrames: frameCount.length,
|
|
363
|
+
outdir,
|
|
346
364
|
renderId: params.renderId,
|
|
347
365
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
348
|
-
codec: params.codec,
|
|
349
366
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
367
|
+
onErrors,
|
|
368
|
+
});
|
|
369
|
+
const encodingStart = Date.now();
|
|
370
|
+
const { outfile, cleanupChunksProm } = await (0, concat_videos_1.concatVideosS3)({
|
|
371
|
+
onProgress,
|
|
372
|
+
numberOfFrames: frameCount.length,
|
|
373
|
+
codec: params.codec,
|
|
350
374
|
fps,
|
|
351
375
|
numberOfGifLoops: params.numberOfGifLoops,
|
|
352
376
|
ffmpegExecutable: null,
|
|
353
377
|
remotionRoot: process.cwd(),
|
|
354
|
-
|
|
378
|
+
files,
|
|
379
|
+
outdir,
|
|
355
380
|
});
|
|
356
|
-
|
|
357
|
-
encodingStop = Date.now();
|
|
358
|
-
}
|
|
381
|
+
const encodingStop = Date.now();
|
|
359
382
|
const outputSize = fs_1.default.statSync(outfile);
|
|
360
383
|
await (0, io_1.lambdaWriteFile)({
|
|
361
384
|
bucketName: renderBucketName,
|
|
@@ -373,22 +396,10 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
373
396
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
374
397
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
375
398
|
});
|
|
376
|
-
const finalEncodingProgress = {
|
|
377
|
-
framesEncoded: frameCount.length,
|
|
378
|
-
totalFrames: frameCount.length,
|
|
379
|
-
doneIn: encodingStop ? encodingStop - encodingStart : null,
|
|
380
|
-
timeToInvoke: (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)({
|
|
381
|
-
contents,
|
|
382
|
-
renderId: params.renderId,
|
|
383
|
-
estimatedRenderLambdaInvokations: renderMetadata.estimatedRenderLambdaInvokations,
|
|
384
|
-
checkIfAllLambdasWereInvoked: false,
|
|
385
|
-
startDate: renderMetadata.startedDate,
|
|
386
|
-
}).timeToInvokeLambdas,
|
|
387
|
-
};
|
|
388
399
|
const finalEncodingProgressProm = (0, io_1.lambdaWriteFile)({
|
|
389
400
|
bucketName: params.bucketName,
|
|
390
401
|
key: (0, constants_1.encodingProgressKey)(params.renderId),
|
|
391
|
-
body:
|
|
402
|
+
body: String(frameCount.length),
|
|
392
403
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
393
404
|
privacy: 'private',
|
|
394
405
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -466,6 +477,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
466
477
|
lambdaErrors: postRenderData.errors,
|
|
467
478
|
outputFile: postRenderData.outputFile,
|
|
468
479
|
timeToFinish: postRenderData.timeToFinish,
|
|
480
|
+
costs: postRenderData.cost,
|
|
469
481
|
},
|
|
470
482
|
});
|
|
471
483
|
webhookInvoked = true;
|
|
@@ -9,13 +9,11 @@ const renderer_1 = require("@remotion/renderer");
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
12
|
+
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
12
13
|
const constants_1 = require("../shared/constants");
|
|
13
14
|
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
14
|
-
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
15
15
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
16
16
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
17
|
-
const get_files_in_folder_1 = require("./helpers/get-files-in-folder");
|
|
18
|
-
const get_folder_size_1 = require("./helpers/get-folder-size");
|
|
19
17
|
const io_1 = require("./helpers/io");
|
|
20
18
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
21
19
|
const renderHandler = async (params, options, logs) => {
|
|
@@ -45,8 +43,10 @@ const renderHandler = async (params, options, logs) => {
|
|
|
45
43
|
startDate: start,
|
|
46
44
|
};
|
|
47
45
|
const outdir = renderer_1.RenderInternals.tmpDir(constants_1.RENDERER_PATH_TOKEN);
|
|
48
|
-
const
|
|
49
|
-
|
|
46
|
+
const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
|
|
47
|
+
? 'h264-mkv'
|
|
48
|
+
: params.codec;
|
|
49
|
+
const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec)}`);
|
|
50
50
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
51
51
|
const downloads = {};
|
|
52
52
|
const inputProps = await inputPropsPromise;
|
|
@@ -64,9 +64,17 @@ const renderHandler = async (params, options, logs) => {
|
|
|
64
64
|
inputProps,
|
|
65
65
|
frameRange: params.frameRange,
|
|
66
66
|
onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
|
|
67
|
-
if (renderedFrames %
|
|
67
|
+
if (renderedFrames % 5 === 0 &&
|
|
68
68
|
renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')) {
|
|
69
69
|
console.log(`Rendered ${renderedFrames} frames, encoded ${encodedFrames} frames, stage = ${stitchStage}`);
|
|
70
|
+
(0, chunk_progress_1.writeLambdaInitializedFile)({
|
|
71
|
+
attempt: params.attempt,
|
|
72
|
+
bucketName: params.bucketName,
|
|
73
|
+
chunk: params.chunk,
|
|
74
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
75
|
+
framesRendered: renderedFrames,
|
|
76
|
+
renderId: params.renderId,
|
|
77
|
+
}).catch((err) => reject(err));
|
|
70
78
|
}
|
|
71
79
|
const allFrames = renderer_1.RenderInternals.getFramesToRender(params.frameRange, params.everyNthFrame);
|
|
72
80
|
if (renderedFrames === allFrames.length) {
|
|
@@ -76,26 +84,13 @@ const renderHandler = async (params, options, logs) => {
|
|
|
76
84
|
},
|
|
77
85
|
concurrency: params.concurrencyPerLambda,
|
|
78
86
|
onStart: () => {
|
|
79
|
-
(0,
|
|
80
|
-
|
|
87
|
+
(0, chunk_progress_1.writeLambdaInitializedFile)({
|
|
88
|
+
attempt: params.attempt,
|
|
81
89
|
bucketName: params.bucketName,
|
|
82
|
-
|
|
83
|
-
filesCleaned: clean_tmpdir_1.deletedFilesSize,
|
|
84
|
-
filesInTmp: fs_1.default.readdirSync('/tmp'),
|
|
85
|
-
isWarm: options.isWarm,
|
|
86
|
-
deletedFiles: clean_tmpdir_1.deletedFiles,
|
|
87
|
-
tmpSize: (0, get_folder_size_1.getFolderSizeRecursively)('/tmp'),
|
|
88
|
-
tmpDirFiles: (0, get_files_in_folder_1.getFolderFiles)('/tmp'),
|
|
89
|
-
}),
|
|
90
|
-
key: (0, constants_1.lambdaChunkInitializedKey)({
|
|
91
|
-
renderId: params.renderId,
|
|
92
|
-
chunk: params.chunk,
|
|
93
|
-
attempt: params.attempt,
|
|
94
|
-
}),
|
|
95
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
90
|
+
chunk: params.chunk,
|
|
96
91
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
framesRendered: 0,
|
|
93
|
+
renderId: params.renderId,
|
|
99
94
|
}).catch((err) => reject(err));
|
|
100
95
|
},
|
|
101
96
|
puppeteerInstance: browserInstance,
|
package/dist/functions/start.js
CHANGED
|
@@ -6,6 +6,7 @@ const version_1 = require("remotion/version");
|
|
|
6
6
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
7
7
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
8
8
|
const constants_1 = require("../shared/constants");
|
|
9
|
+
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
9
10
|
const random_hash_1 = require("../shared/random-hash");
|
|
10
11
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
11
12
|
const io_1 = require("./helpers/io");
|
|
@@ -20,14 +21,20 @@ const startHandler = async (params, options) => {
|
|
|
20
21
|
}
|
|
21
22
|
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), 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 ${params.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
22
23
|
}
|
|
24
|
+
const region = (0, get_current_region_1.getCurrentRegionInFunction)();
|
|
23
25
|
const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
24
26
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
25
27
|
});
|
|
28
|
+
const realServeUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
|
|
29
|
+
urlOrId: params.serveUrl,
|
|
30
|
+
region,
|
|
31
|
+
bucketName,
|
|
32
|
+
});
|
|
26
33
|
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
27
34
|
const initialFile = (0, io_1.lambdaWriteFile)({
|
|
28
35
|
bucketName,
|
|
29
36
|
downloadBehavior: null,
|
|
30
|
-
region
|
|
37
|
+
region,
|
|
31
38
|
body: 'Render was initialized',
|
|
32
39
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
33
40
|
key: (0, constants_1.initalizedMetadataKey)(renderId),
|
|
@@ -38,7 +45,7 @@ const startHandler = async (params, options) => {
|
|
|
38
45
|
type: constants_1.LambdaRoutines.launch,
|
|
39
46
|
framesPerLambda: params.framesPerLambda,
|
|
40
47
|
composition: params.composition,
|
|
41
|
-
serveUrl:
|
|
48
|
+
serveUrl: realServeUrl,
|
|
42
49
|
inputProps: params.inputProps,
|
|
43
50
|
bucketName,
|
|
44
51
|
renderId,
|
package/dist/functions/still.js
CHANGED
|
@@ -14,6 +14,7 @@ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
|
14
14
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
15
15
|
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
16
16
|
const constants_1 = require("../shared/constants");
|
|
17
|
+
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
17
18
|
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
18
19
|
const make_s3_url_1 = require("../shared/make-s3-url");
|
|
19
20
|
const random_hash_1 = require("../shared/random-hash");
|
|
@@ -53,14 +54,20 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
53
54
|
const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
54
55
|
const outputPath = path_1.default.join(outputDir, 'output');
|
|
55
56
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
57
|
+
const region = (0, get_current_region_1.getCurrentRegionInFunction)();
|
|
56
58
|
const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
|
|
57
59
|
bucketName,
|
|
58
60
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
59
|
-
region
|
|
61
|
+
region,
|
|
60
62
|
serialized: lambdaParams.inputProps,
|
|
61
63
|
});
|
|
64
|
+
const serveUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
|
|
65
|
+
urlOrId: lambdaParams.serveUrl,
|
|
66
|
+
region,
|
|
67
|
+
bucketName,
|
|
68
|
+
});
|
|
62
69
|
const composition = await (0, validate_composition_1.validateComposition)({
|
|
63
|
-
serveUrl
|
|
70
|
+
serveUrl,
|
|
64
71
|
browserInstance,
|
|
65
72
|
composition: lambdaParams.composition,
|
|
66
73
|
inputProps,
|
|
@@ -81,7 +88,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
81
88
|
compositionId: lambdaParams.composition,
|
|
82
89
|
estimatedTotalLambdaInvokations: 1,
|
|
83
90
|
estimatedRenderLambdaInvokations: 1,
|
|
84
|
-
siteId: (0, make_s3_url_1.getServeUrlHash)(
|
|
91
|
+
siteId: (0, make_s3_url_1.getServeUrlHash)(serveUrl),
|
|
85
92
|
totalChunks: 1,
|
|
86
93
|
type: 'still',
|
|
87
94
|
imageFormat: lambdaParams.imageFormat,
|
|
@@ -93,6 +100,8 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
93
100
|
renderId,
|
|
94
101
|
outName: (_b = lambdaParams.outName) !== null && _b !== void 0 ? _b : undefined,
|
|
95
102
|
privacy: lambdaParams.privacy,
|
|
103
|
+
everyNthFrame: 1,
|
|
104
|
+
frameRange: [lambdaParams.frame, lambdaParams.frame],
|
|
96
105
|
};
|
|
97
106
|
await (0, io_1.lambdaWriteFile)({
|
|
98
107
|
bucketName,
|
|
@@ -107,7 +116,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
107
116
|
await (0, renderer_1.renderStill)({
|
|
108
117
|
composition,
|
|
109
118
|
output: outputPath,
|
|
110
|
-
serveUrl
|
|
119
|
+
serveUrl,
|
|
111
120
|
dumpBrowserLogs: false,
|
|
112
121
|
envVariables: lambdaParams.envVariables,
|
|
113
122
|
frame: renderer_1.RenderInternals.convertToPositiveFrameIndex({
|
|
@@ -190,7 +199,9 @@ const stillHandler = async (params, options) => {
|
|
|
190
199
|
const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
191
200
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
192
201
|
});
|
|
193
|
-
|
|
202
|
+
// `await` elided on purpose here; using `void` to mark it as intentional
|
|
203
|
+
// eslint-disable-next-line no-void
|
|
204
|
+
void (0, write_lambda_error_1.writeLambdaError)({
|
|
194
205
|
bucketName,
|
|
195
206
|
errorInfo: {
|
|
196
207
|
chunk: null,
|
package/dist/index.d.ts
CHANGED
|
@@ -32,9 +32,8 @@ import { simulatePermissions } from './api/iam-validation/simulate';
|
|
|
32
32
|
import { getRolePolicy, getUserPolicy } from './api/iam-validation/suggested-policy';
|
|
33
33
|
import { presignUrl } from './api/presign-url';
|
|
34
34
|
import type { RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput } from './api/render-media-on-lambda';
|
|
35
|
-
import {
|
|
35
|
+
import { renderVideoOnLambda } from './api/render-media-on-lambda';
|
|
36
36
|
import type { RenderStillOnLambdaInput, RenderStillOnLambdaOutput } from './api/render-still-on-lambda';
|
|
37
|
-
import { renderStillOnLambda } from './api/render-still-on-lambda';
|
|
38
37
|
import { validateWebhookSignature } from './api/validate-webhook-signature';
|
|
39
38
|
import type { LambdaLSInput, LambdaLsReturnType } from './functions/helpers/io';
|
|
40
39
|
import type { EnhancedErrorInfo, LambdaErrorInfo } from './functions/helpers/write-lambda-error';
|
|
@@ -44,5 +43,13 @@ import type { CustomCredentials } from './shared/aws-clients';
|
|
|
44
43
|
import type { RenderProgress } from './shared/constants';
|
|
45
44
|
import type { WebhookPayload } from './shared/invoke-webhook';
|
|
46
45
|
import type { LambdaArchitecture } from './shared/validate-architecture';
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
48
|
+
*/
|
|
49
|
+
declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
52
|
+
*/
|
|
53
|
+
declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
47
54
|
export { deleteSite, deployFunction, deploySite, downloadMedia, downloadVideo, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, getCompositionsOnLambda, };
|
|
48
55
|
export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput, GetRenderInput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, SimulatePermissionsInput, SimulatePermissionsOutput, GetAwsClientInput, GetAwsClientOutput, LambdaArchitecture, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, GetCompositionsOnLambdaOutput, GetCompositionsOnLambdaInput, };
|
package/dist/index.js
CHANGED
|
@@ -40,11 +40,19 @@ Object.defineProperty(exports, "getUserPolicy", { enumerable: true, get: functio
|
|
|
40
40
|
const presign_url_1 = require("./api/presign-url");
|
|
41
41
|
Object.defineProperty(exports, "presignUrl", { enumerable: true, get: function () { return presign_url_1.presignUrl; } });
|
|
42
42
|
const render_media_on_lambda_1 = require("./api/render-media-on-lambda");
|
|
43
|
-
Object.defineProperty(exports, "renderMediaOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderMediaOnLambda; } });
|
|
44
43
|
Object.defineProperty(exports, "renderVideoOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderVideoOnLambda; } });
|
|
45
44
|
const render_still_on_lambda_1 = require("./api/render-still-on-lambda");
|
|
46
|
-
Object.defineProperty(exports, "renderStillOnLambda", { enumerable: true, get: function () { return render_still_on_lambda_1.renderStillOnLambda; } });
|
|
47
45
|
const validate_webhook_signature_1 = require("./api/validate-webhook-signature");
|
|
48
46
|
Object.defineProperty(exports, "validateWebhookSignature", { enumerable: true, get: function () { return validate_webhook_signature_1.validateWebhookSignature; } });
|
|
49
47
|
const internals_1 = require("./internals");
|
|
50
48
|
Object.defineProperty(exports, "LambdaInternals", { enumerable: true, get: function () { return internals_1.LambdaInternals; } });
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
51
|
+
*/
|
|
52
|
+
const renderMediaOnLambda = render_media_on_lambda_1.renderMediaOnLambda;
|
|
53
|
+
exports.renderMediaOnLambda = renderMediaOnLambda;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
56
|
+
*/
|
|
57
|
+
const renderStillOnLambda = render_still_on_lambda_1.renderStillOnLambda;
|
|
58
|
+
exports.renderStillOnLambda = renderStillOnLambda;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const DEFAULT_AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "sa-east-1"];
|
|
2
|
+
export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-south-1", "ap-east-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "me-south-1", "sa-east-1"];
|
|
2
3
|
export declare type AwsRegion = typeof AWS_REGIONS[number];
|
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AWS_REGIONS = void 0;
|
|
3
|
+
exports.AWS_REGIONS = exports.DEFAULT_AWS_REGIONS = void 0;
|
|
4
|
+
exports.DEFAULT_AWS_REGIONS = [
|
|
5
|
+
'eu-central-1',
|
|
6
|
+
'eu-west-1',
|
|
7
|
+
'eu-west-2',
|
|
8
|
+
'eu-west-3',
|
|
9
|
+
'eu-north-1',
|
|
10
|
+
'us-east-1',
|
|
11
|
+
'us-east-2',
|
|
12
|
+
'us-west-1',
|
|
13
|
+
'us-west-2',
|
|
14
|
+
'ap-south-1',
|
|
15
|
+
'ap-southeast-1',
|
|
16
|
+
'ap-southeast-2',
|
|
17
|
+
'ap-northeast-1',
|
|
18
|
+
'ap-northeast-2',
|
|
19
|
+
'ap-northeast-3',
|
|
20
|
+
'ca-central-1',
|
|
21
|
+
'sa-east-1',
|
|
22
|
+
];
|
|
4
23
|
exports.AWS_REGIONS = [
|
|
5
24
|
'eu-central-1',
|
|
6
25
|
'eu-west-1',
|
|
7
26
|
'eu-west-2',
|
|
27
|
+
'eu-west-3',
|
|
28
|
+
'eu-south-1',
|
|
29
|
+
'eu-north-1',
|
|
8
30
|
'us-east-1',
|
|
9
31
|
'us-east-2',
|
|
32
|
+
'us-west-1',
|
|
10
33
|
'us-west-2',
|
|
34
|
+
'af-south-1',
|
|
11
35
|
'ap-south-1',
|
|
36
|
+
'ap-east-1',
|
|
12
37
|
'ap-southeast-1',
|
|
13
38
|
'ap-southeast-2',
|
|
14
39
|
'ap-northeast-1',
|
|
40
|
+
'ap-northeast-2',
|
|
41
|
+
'ap-northeast-3',
|
|
42
|
+
'ca-central-1',
|
|
43
|
+
'me-south-1',
|
|
44
|
+
'sa-east-1',
|
|
15
45
|
];
|