@remotion/lambda 4.0.0-alpha5 → 4.0.0-alpha7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/admin/bundle-lambda.js +11 -10
  2. package/dist/admin/generate-etag-list.js +4 -4
  3. package/dist/api/create-function.js +2 -2
  4. package/dist/api/deploy-site.js +2 -2
  5. package/dist/api/download-media.js +2 -2
  6. package/dist/api/get-sites.d.ts +0 -1
  7. package/dist/api/make-lambda-payload.d.ts +41 -0
  8. package/dist/api/make-lambda-payload.js +65 -0
  9. package/dist/api/render-media-on-lambda.d.ts +2 -2
  10. package/dist/api/render-media-on-lambda.js +4 -60
  11. package/dist/api/upload-dir.js +7 -7
  12. package/dist/cli/commands/functions/deploy.js +6 -3
  13. package/dist/cli/commands/functions/ls.js +8 -3
  14. package/dist/cli/commands/functions/rm.js +12 -5
  15. package/dist/cli/commands/functions/rmall.js +12 -6
  16. package/dist/cli/commands/quotas/increase.js +2 -2
  17. package/dist/cli/commands/render/render.js +9 -6
  18. package/dist/cli/commands/sites/create.js +4 -1
  19. package/dist/cli/commands/still.js +1 -1
  20. package/dist/cli/help.js +4 -0
  21. package/dist/cli/index.js +3 -3
  22. package/dist/cli/log.d.ts +2 -0
  23. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
  24. package/dist/functions/helpers/clean-tmpdir.js +7 -7
  25. package/dist/functions/helpers/concat-videos.js +7 -7
  26. package/dist/functions/helpers/get-browser-instance.js +1 -0
  27. package/dist/functions/helpers/get-chromium-executable-path.js +4 -8
  28. package/dist/functions/helpers/get-files-in-folder.js +5 -5
  29. package/dist/functions/helpers/io.d.ts +1 -1
  30. package/dist/functions/launch.js +10 -12
  31. package/dist/functions/renderer.js +6 -6
  32. package/dist/functions/still.js +6 -6
  33. package/dist/index.d.ts +1 -1
  34. package/dist/internals.d.ts +40 -0
  35. package/dist/internals.js +2 -0
  36. package/dist/shared/aws-clients.js +2 -2
  37. package/dist/shared/call-lambda.js +11 -0
  38. package/dist/shared/function-zip-path.js +2 -2
  39. package/dist/shared/get-etag.js +4 -4
  40. package/dist/shared/hosted-layers.js +0 -84
  41. package/dist/shared/invoke-webhook.d.ts +3 -1
  42. package/dist/shared/invoke-webhook.js +4 -4
  43. package/dist/shared/make-s3-key.js +2 -2
  44. package/dist/shared/make-s3-url.js +2 -2
  45. package/dist/shared/read-dir.js +2 -2
  46. package/dist/shared/serialize-input-props.js +1 -1
  47. package/dist/shared/validate-privacy.js +1 -1
  48. package/package.json +8 -8
  49. package/remotionlambda-arm64.zip +0 -0
  50. package/dist/functions/helpers/get-current-architecture.d.ts +0 -2
  51. package/dist/functions/helpers/get-current-architecture.js +0 -11
  52. package/dist/shared/validate-architecture.d.ts +0 -4
  53. package/dist/shared/validate-architecture.js +0 -14
  54. package/remotionlambda-x64.zip +0 -0
@@ -104,7 +104,7 @@ const stillCommand = async (args, remotionRoot) => {
104
104
  stack: err.stack,
105
105
  stackFrame: frames,
106
106
  });
107
- await cli_1.CliInternals.handleCommonError(errorWithStackFrame);
107
+ await cli_1.CliInternals.handleCommonError(errorWithStackFrame, renderer_1.RenderInternals.getLogLevel());
108
108
  (0, quit_1.quit)(1);
109
109
  }
110
110
  };
package/dist/cli/help.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printHelp = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const constants_1 = require("../shared/constants");
6
+ const compositions_1 = require("./commands/compositions");
6
7
  const functions_1 = require("./commands/functions");
7
8
  const policies_1 = require("./commands/policies/policies");
8
9
  const quotas_1 = require("./commands/quotas");
@@ -28,6 +29,9 @@ const printHelp = () => {
28
29
  log_1.Log.info(`${constants_1.BINARY_NAME} ${sites_1.SITES_COMMAND}`);
29
30
  log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
30
31
  log_1.Log.info();
32
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${compositions_1.COMPOSITIONS_COMMAND}`);
33
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Print list of composition IDs from a serve URL.'));
34
+ log_1.Log.info();
31
35
  log_1.Log.info(`${constants_1.BINARY_NAME} ${policies_1.POLICIES_COMMAND}`);
32
36
  log_1.Log.info(cli_1.CliInternals.chalk.gray('View and validate AWS policy files.'));
33
37
  log_1.Log.info();
package/dist/cli/index.js CHANGED
@@ -30,9 +30,9 @@ const requiresCredentials = (args) => {
30
30
  if (args[1] === role_1.ROLE_SUBCOMMAND) {
31
31
  return false;
32
32
  }
33
- if (args[1] === regions_1.REGIONS_COMMAND) {
34
- return false;
35
- }
33
+ }
34
+ if (args[0] === regions_1.REGIONS_COMMAND) {
35
+ return false;
36
36
  }
37
37
  return true;
38
38
  };
package/dist/cli/log.d.ts CHANGED
@@ -3,6 +3,8 @@ export declare const Log: {
3
3
  verboseAdvanced: (options: {
4
4
  indent: boolean;
5
5
  logLevel: "error" | "verbose" | "info" | "warn";
6
+ } & {
7
+ tag?: string | undefined;
6
8
  }, message?: any, ...optionalParams: any[]) => void;
7
9
  info: (message?: any, ...optionalParams: any[]) => void;
8
10
  infoAdvanced: (options: {
@@ -3,8 +3,5 @@ export declare const planFrameRanges: ({ framesPerLambda, frameRange, everyNthFr
3
3
  frameRange: [number, number];
4
4
  everyNthFrame: number;
5
5
  }) => {
6
- chunks: [
7
- number,
8
- number
9
- ][];
6
+ chunks: [number, number][];
10
7
  };
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.deleteTmpDir = exports.deletedFilesSize = exports.deletedFiles = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = require("path");
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = require("node:path");
9
9
  exports.deletedFiles = [];
10
10
  exports.deletedFilesSize = 0;
11
11
  const deleteAllFilesInAFolderRecursively = (path) => {
12
- const files = fs_1.default.readdirSync(path);
12
+ const files = node_fs_1.default.readdirSync(path);
13
13
  files.forEach((file) => {
14
- const filePath = (0, path_1.join)(path, file);
14
+ const filePath = (0, node_path_1.join)(path, file);
15
15
  try {
16
- const stat = fs_1.default.statSync(filePath);
16
+ const stat = node_fs_1.default.statSync(filePath);
17
17
  if (stat.isDirectory()) {
18
18
  deleteAllFilesInAFolderRecursively(filePath);
19
19
  }
20
20
  else {
21
- fs_1.default.unlinkSync(filePath);
21
+ node_fs_1.default.unlinkSync(filePath);
22
22
  exports.deletedFilesSize += stat.size;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@ const deleteAllFilesInAFolderRecursively = (path) => {
29
29
  exports.deletedFiles.push(filePath);
30
30
  });
31
31
  if (path !== '/tmp') {
32
- fs_1.default.rmSync(path, { recursive: true, force: true });
32
+ node_fs_1.default.rmSync(path, { recursive: true, force: true });
33
33
  }
34
34
  };
35
35
  const deleteTmpDir = () => {
@@ -25,14 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.concatVideosS3 = exports.getAllFilesS3 = void 0;
27
27
  const renderer_1 = require("@remotion/renderer");
28
- const fs_1 = __importStar(require("fs"));
29
- const path_1 = __importStar(require("path"));
28
+ const node_fs_1 = __importStar(require("node:fs"));
29
+ const node_path_1 = __importStar(require("node:path"));
30
30
  const constants_1 = require("../../shared/constants");
31
31
  const inspect_errors_1 = require("./inspect-errors");
32
32
  const io_1 = require("./io");
33
33
  const timer_1 = require("./timer");
34
34
  const getChunkDownloadOutputLocation = ({ outdir, file, }) => {
35
- return path_1.default.join(outdir, path_1.default.basename(file));
35
+ return node_path_1.default.join(outdir, node_path_1.default.basename(file));
36
36
  };
37
37
  const downloadS3File = async ({ bucket, key, outdir, region, expectedBucketOwner, }) => {
38
38
  const Body = await (0, io_1.lambdaReadFile)({
@@ -43,10 +43,10 @@ const downloadS3File = async ({ bucket, key, outdir, region, expectedBucketOwner
43
43
  });
44
44
  const outpath = getChunkDownloadOutputLocation({ outdir, file: key });
45
45
  if (Buffer.isBuffer(Body)) {
46
- return fs_1.promises.writeFile(outpath, Body);
46
+ return node_fs_1.promises.writeFile(outpath, Body);
47
47
  }
48
48
  return new Promise((resolve, reject) => {
49
- Body.pipe((0, fs_1.createWriteStream)(outpath))
49
+ Body.pipe((0, node_fs_1.createWriteStream)(outpath))
50
50
  .on('error', (err) => reject(err))
51
51
  .on('close', () => resolve());
52
52
  });
@@ -129,7 +129,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
129
129
  };
130
130
  exports.getAllFilesS3 = getAllFilesS3;
131
131
  const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, }) => {
132
- const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
132
+ const outfile = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
133
133
  const combine = (0, timer_1.timer)('Combine videos');
134
134
  const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
135
135
  await renderer_1.RenderInternals.combineVideos({
@@ -144,7 +144,7 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
144
144
  audioCodec,
145
145
  });
146
146
  combine.end();
147
- const cleanupChunksProm = fs_1.default.promises.rm(outdir, {
147
+ const cleanupChunksProm = node_fs_1.default.promises.rm(outdir, {
148
148
  recursive: true,
149
149
  });
150
150
  return { outfile, cleanupChunksProm };
@@ -42,6 +42,7 @@ const getBrowserInstance = async (shouldDumpIo, chromiumOptions) => {
42
42
  browserExecutable: execPath,
43
43
  shouldDumpIo,
44
44
  chromiumOptions: actualChromiumOptions,
45
+ indent: false,
45
46
  });
46
47
  _browserInstance.on('disconnected', () => {
47
48
  console.log('Browser disconnected / crashed');
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.executablePath = void 0;
5
5
  if (/^AWS_Lambda_nodejs(?:18)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') ===
6
6
  true) {
7
- if (process.env.FONTCONFIG_PATH === undefined) {
8
- process.env.FONTCONFIG_PATH = '/opt';
9
- process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
10
- }
11
- process.env.LD_LIBRARY_PATH = '/opt/lib:/opt/bin';
12
- process.env.FFMPEG_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffmpeg';
13
- process.env.FFPROBE_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffprobe';
14
- process.env.FFMPEG_CWD = '/opt/ffmpeg';
7
+ process.env.FONTCONFIG_PATH = '/opt';
8
+ process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
9
+ process.env.READ_ONLY_FS = '1';
15
10
  process.env.COMPOSITOR_PATH = './compositor';
11
+ process.env.NO_COLOR = '1';
16
12
  }
17
13
  const executablePath = () => {
18
14
  return '/opt/bin/chromium';
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getFolderFiles = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  function getFolderFiles(folder) {
10
- const files = fs_1.default.readdirSync(folder);
10
+ const files = node_fs_1.default.readdirSync(folder);
11
11
  const paths = [];
12
12
  files.forEach((file) => {
13
- const full = path_1.default.join(folder, file);
13
+ const full = node_path_1.default.join(folder, file);
14
14
  try {
15
- const stat = fs_1.default.statSync(full);
15
+ const stat = node_fs_1.default.statSync(full);
16
16
  if (stat.isDirectory()) {
17
17
  paths.push(...getFolderFiles(full));
18
18
  }
@@ -1,5 +1,5 @@
1
1
  import type { _Object } from '@aws-sdk/client-s3';
2
- import type { ReadStream } from 'fs';
2
+ import type { ReadStream } from 'node:fs';
3
3
  import type { Readable } from 'stream';
4
4
  import type { AwsRegion } from '../../pricing/aws-regions';
5
5
  import type { CustomCredentials } from '../../shared/aws-clients';
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.launchHandler = void 0;
27
27
  const client_lambda_1 = require("@aws-sdk/client-lambda");
28
28
  const renderer_1 = require("@remotion/renderer");
29
- const fs_1 = __importStar(require("fs"));
30
- const path_1 = require("path");
29
+ const node_fs_1 = __importStar(require("node:fs"));
30
+ const node_path_1 = require("node:path");
31
31
  const remotion_1 = require("remotion");
32
32
  const version_1 = require("remotion/version");
33
33
  const aws_clients_1 = require("../shared/aws-clients");
@@ -187,7 +187,6 @@ const innerLaunchHandler = async (params, options) => {
187
187
  everyNthFrame: params.everyNthFrame,
188
188
  });
189
189
  const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
190
- const invokers = Math.round(Math.sqrt(chunks.length));
191
190
  const reqSend = (0, timer_1.timer)('sending off requests');
192
191
  const lambdaPayloads = chunks.map((chunkPayload) => {
193
192
  var _a;
@@ -238,9 +237,8 @@ const innerLaunchHandler = async (params, options) => {
238
237
  estimatedTotalLambdaInvokations: [
239
238
  // Direct invokations
240
239
  chunks.length,
241
- // Parent invokers
242
- invokers,
243
240
  // This function
241
+ 1,
244
242
  ].reduce((a, b) => a + b, 0),
245
243
  estimatedRenderLambdaInvokations: chunks.length,
246
244
  compositionId: comp.id,
@@ -362,13 +360,13 @@ const innerLaunchHandler = async (params, options) => {
362
360
  throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
363
361
  };
364
362
  const fps = comp.fps / params.everyNthFrame;
365
- const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
366
- if ((0, fs_1.existsSync)(outdir)) {
367
- (0, fs_1.rmSync)(outdir, {
363
+ const outdir = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
364
+ if ((0, node_fs_1.existsSync)(outdir)) {
365
+ (0, node_fs_1.rmSync)(outdir, {
368
366
  recursive: true,
369
367
  });
370
368
  }
371
- (0, fs_1.mkdirSync)(outdir);
369
+ (0, node_fs_1.mkdirSync)(outdir);
372
370
  const files = await (0, concat_videos_1.getAllFilesS3)({
373
371
  bucket: params.bucketName,
374
372
  expectedFiles: chunkCount,
@@ -390,11 +388,11 @@ const innerLaunchHandler = async (params, options) => {
390
388
  audioCodec: params.audioCodec,
391
389
  });
392
390
  const encodingStop = Date.now();
393
- const outputSize = fs_1.default.statSync(outfile);
391
+ const outputSize = node_fs_1.default.statSync(outfile);
394
392
  await (0, io_1.lambdaWriteFile)({
395
393
  bucketName: renderBucketName,
396
394
  key,
397
- body: fs_1.default.createReadStream(outfile),
395
+ body: node_fs_1.default.createReadStream(outfile),
398
396
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
399
397
  privacy: params.privacy,
400
398
  expectedBucketOwner: options.expectedBucketOwner,
@@ -473,7 +471,7 @@ const innerLaunchHandler = async (params, options) => {
473
471
  customCredentials: null,
474
472
  });
475
473
  renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
476
- await Promise.all([cleanupChunksProm, fs_1.default.promises.rm(outfile)]);
474
+ await Promise.all([cleanupChunksProm, node_fs_1.default.promises.rm(outfile)]);
477
475
  clearTimeout(webhookDueToTimeout);
478
476
  if (params.webhook && !webhookInvoked) {
479
477
  try {
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.rendererHandler = void 0;
7
7
  const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
11
  const version_1 = require("remotion/version");
12
12
  const aws_clients_1 = require("../shared/aws-clients");
13
13
  const chunk_progress_1 = require("../shared/chunk-progress");
@@ -51,7 +51,7 @@ const renderHandler = async (params, options, logs) => {
51
51
  const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
52
52
  ? 'h264-mkv'
53
53
  : params.codec;
54
- const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
54
+ const outputLocation = node_path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
55
55
  codec: params.codec,
56
56
  preferLossless: true,
57
57
  }))}`);
@@ -178,7 +178,7 @@ const renderHandler = async (params, options, logs) => {
178
178
  renderId: params.renderId,
179
179
  index: params.chunk,
180
180
  }),
181
- body: fs_1.default.createReadStream(outputLocation),
181
+ body: node_fs_1.default.createReadStream(outputLocation),
182
182
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
183
183
  privacy: params.privacy,
184
184
  expectedBucketOwner: options.expectedBucketOwner,
@@ -186,8 +186,8 @@ const renderHandler = async (params, options, logs) => {
186
186
  customCredentials: null,
187
187
  });
188
188
  await Promise.all([
189
- fs_1.default.promises.rm(outputLocation, { recursive: true }),
190
- fs_1.default.promises.rm(outputPath, { recursive: true }),
189
+ node_fs_1.default.promises.rm(outputLocation, { recursive: true }),
190
+ node_fs_1.default.promises.rm(outputPath, { recursive: true }),
191
191
  (0, io_1.lambdaWriteFile)({
192
192
  bucketName: params.bucketName,
193
193
  body: JSON.stringify(condensedTimingData, null, 2),
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.stillHandler = void 0;
7
7
  const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
11
  const version_1 = require("remotion/version");
12
12
  const estimate_price_1 = require("../api/estimate-price");
13
13
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
@@ -52,7 +52,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
52
52
  (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
53
53
  ]);
54
54
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
55
- const outputPath = path_1.default.join(outputDir, 'output');
55
+ const outputPath = node_path_1.default.join(outputDir, 'output');
56
56
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
57
57
  const region = (0, get_current_region_1.getCurrentRegionInFunction)();
58
58
  const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
@@ -134,19 +134,19 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
134
134
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
135
135
  });
136
136
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
137
- const { size } = await fs_1.default.promises.stat(outputPath);
137
+ const { size } = await node_fs_1.default.promises.stat(outputPath);
138
138
  await (0, io_1.lambdaWriteFile)({
139
139
  bucketName: renderBucketName,
140
140
  key,
141
141
  privacy: lambdaParams.privacy,
142
- body: fs_1.default.createReadStream(outputPath),
142
+ body: node_fs_1.default.createReadStream(outputPath),
143
143
  expectedBucketOwner: options.expectedBucketOwner,
144
144
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
145
145
  downloadBehavior: lambdaParams.downloadBehavior,
146
146
  customCredentials,
147
147
  });
148
148
  await Promise.all([
149
- fs_1.default.promises.rm(outputPath, { recursive: true }),
149
+ node_fs_1.default.promises.rm(outputPath, { recursive: true }),
150
150
  (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
151
151
  bucketName,
152
152
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ import type { WebhookPayload } from './shared/invoke-webhook';
43
43
  /**
44
44
  * @deprecated Import this from `@remotion/lambda/client` instead
45
45
  */
46
- declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
46
+ declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
47
47
  /**
48
48
  * @deprecated Import this from `@remotion/lambda/client` instead
49
49
  */
@@ -1,3 +1,43 @@
1
1
  export declare const LambdaInternals: {
2
2
  executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
3
+ makeLambdaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: import(".").RenderMediaOnLambdaInput) => Promise<{
4
+ rendererFunctionName: string | null;
5
+ framesPerLambda: number | null;
6
+ composition: string;
7
+ serveUrl: string;
8
+ inputProps: import("./defaults").SerializedInputProps;
9
+ codec: "h264" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "gif" | "prores";
10
+ imageFormat: "png" | "jpeg" | "none";
11
+ crf: number | undefined;
12
+ envVariables: Record<string, string> | undefined;
13
+ pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
14
+ proResProfile: "standard" | "4444-xq" | "4444" | "hq" | "light" | "proxy" | undefined;
15
+ jpegQuality: number | undefined;
16
+ maxRetries: number;
17
+ privacy: import("./defaults").Privacy;
18
+ logLevel: "error" | "verbose" | "info" | "warn";
19
+ frameRange: import("@remotion/renderer").FrameRange | null;
20
+ outName: import("./defaults").OutNameInput | null;
21
+ timeoutInMilliseconds: number;
22
+ chromiumOptions: import("@remotion/renderer").ChromiumOptions;
23
+ scale: number;
24
+ everyNthFrame: number;
25
+ numberOfGifLoops: number;
26
+ concurrencyPerLambda: number;
27
+ downloadBehavior: import("./shared/content-disposition-header").DownloadBehavior;
28
+ muted: boolean;
29
+ version: string;
30
+ overwrite: boolean;
31
+ audioBitrate: string | null;
32
+ videoBitrate: string | null;
33
+ webhook: {
34
+ url: string;
35
+ secret: string | null;
36
+ } | null;
37
+ forceHeight: number | null;
38
+ forceWidth: number | null;
39
+ bucketName: string | null;
40
+ audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
41
+ dumpBrowserLogs: boolean;
42
+ }>;
3
43
  };
package/dist/internals.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LambdaInternals = void 0;
4
+ const make_lambda_payload_1 = require("./api/make-lambda-payload");
4
5
  const index_1 = require("./cli/index");
5
6
  exports.LambdaInternals = {
6
7
  executeCommand: index_1.executeCommand,
8
+ makeLambdaPayload: make_lambda_payload_1.makeLambdaPayload,
7
9
  };
@@ -8,7 +8,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
8
8
  const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
9
9
  const client_sts_1 = require("@aws-sdk/client-sts");
10
10
  const credential_providers_1 = require("@aws-sdk/credential-providers");
11
- const crypto_1 = require("crypto");
11
+ const node_crypto_1 = require("node:crypto");
12
12
  const check_credentials_1 = require("./check-credentials");
13
13
  const is_in_lambda_1 = require("./is-in-lambda");
14
14
  const _clients = {};
@@ -90,7 +90,7 @@ const getCredentialsHash = ({ customCredentials, region, service, }) => {
90
90
  hashComponents.customCredentials = customCredentials;
91
91
  hashComponents.region = region;
92
92
  hashComponents.service = service;
93
- return (0, crypto_1.createHash)('sha256')
93
+ return (0, node_crypto_1.createHash)('sha256')
94
94
  .update(JSON.stringify(hashComponents))
95
95
  .digest('base64');
96
96
  };
@@ -12,6 +12,17 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
12
12
  }));
13
13
  const string = Buffer.from(res.Payload).toString();
14
14
  const json = JSON.parse(string);
15
+ if (json === null) {
16
+ throw new Error('Lambda function unexpectedly returned null: ' +
17
+ JSON.stringify({
18
+ payload,
19
+ type,
20
+ functionName,
21
+ json,
22
+ error: res.FunctionError,
23
+ version: res.$metadata,
24
+ }));
25
+ }
15
26
  if ('errorMessage' in json) {
16
27
  const err = new Error(json.errorMessage);
17
28
  err.name = json.errorType;
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FUNCTION_ZIP_ARM64 = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- exports.FUNCTION_ZIP_ARM64 = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ exports.FUNCTION_ZIP_ARM64 = node_path_1.default.join(node_path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getEtagOfFile = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const crypto_1 = __importDefault(require("crypto"));
7
+ const node_crypto_1 = __importDefault(require("node:crypto"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
9
  const chunk = 1024 * 1024 * 5; // 5MB
10
- const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
10
+ const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
11
11
  const getEtagOfFile = async (filePath) => {
12
- const stream = await fs_1.default.promises.readFile(filePath);
12
+ const stream = await node_fs_1.default.promises.readFile(filePath);
13
13
  if (stream.length <= chunk) {
14
14
  return `"${md5(stream)}"`;
15
15
  }