@remotion/lambda 4.0.168 → 4.0.169

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.
@@ -59,11 +59,11 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
59
59
  getValue: ({ commandLine }: {
60
60
  commandLine: Record<string, unknown>;
61
61
  }) => {
62
- value: "error" | "verbose" | "info" | "warn";
62
+ value: "verbose" | "info" | "warn" | "error";
63
63
  source: string;
64
64
  };
65
- setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
66
- type: "error" | "verbose" | "info" | "warn";
65
+ setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
66
+ type: "verbose" | "info" | "warn" | "error";
67
67
  };
68
68
  readonly throwIfSiteExists: {
69
69
  cliFlag: string;
@@ -0,0 +1,5 @@
1
+ import type { SerializedInputProps } from '../../defaults';
2
+ export declare const cleanupProps: ({ serializedResolvedProps, inputProps, }: {
3
+ serializedResolvedProps: SerializedInputProps;
4
+ inputProps: SerializedInputProps;
5
+ }) => Promise<[number, number]>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanupProps = void 0;
4
+ const cleanup_serialized_input_props_1 = require("../../shared/cleanup-serialized-input-props");
5
+ const get_current_region_1 = require("./get-current-region");
6
+ const cleanupProps = ({ serializedResolvedProps, inputProps, }) => {
7
+ const cleanupSerializedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
8
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
9
+ serialized: inputProps,
10
+ });
11
+ const cleanupResolvedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedResolvedProps)({
12
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
13
+ serialized: serializedResolvedProps,
14
+ });
15
+ return Promise.all([
16
+ cleanupSerializedInputPropsProm,
17
+ cleanupResolvedInputPropsProm,
18
+ ]);
19
+ };
20
+ exports.cleanupProps = cleanupProps;
@@ -1 +1 @@
1
- export declare const getCurrentRegionInFunction: () => "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" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
1
+ export declare const getCurrentRegionInFunction: () => "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";
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.mergeChunksAndFinishRender = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
- const cleanup_serialized_input_props_1 = require("../../shared/cleanup-serialized-input-props");
8
+ const cleanup_props_1 = require("./cleanup-props");
9
9
  const concat_videos_1 = require("./concat-videos");
10
10
  const create_post_render_data_1 = require("./create-post-render-data");
11
11
  const get_current_region_1 = require("./get-current-region");
@@ -56,15 +56,9 @@ const mergeChunksAndFinishRender = async (options) => {
56
56
  const errorExplanations = (0, inspect_errors_1.inspectErrors)({
57
57
  errors: options.overallProgress.get().errors,
58
58
  });
59
- const cleanupSerializedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
60
- bucketName: options.bucketName,
61
- region: (0, get_current_region_1.getCurrentRegionInFunction)(),
62
- serialized: options.inputProps,
63
- });
64
- const cleanupResolvedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedResolvedProps)({
65
- bucketName: options.bucketName,
66
- region: (0, get_current_region_1.getCurrentRegionInFunction)(),
67
- serialized: options.serializedResolvedProps,
59
+ const cleanupProm = (0, cleanup_props_1.cleanupProps)({
60
+ inputProps: options.inputProps,
61
+ serializedResolvedProps: options.serializedResolvedProps,
68
62
  });
69
63
  const { url: outputUrl } = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(options.renderMetadata, options.bucketName, options.customCredentials);
70
64
  const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
@@ -72,10 +66,7 @@ const mergeChunksAndFinishRender = async (options) => {
72
66
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
73
67
  renderMetadata: options.renderMetadata,
74
68
  errorExplanations,
75
- timeToDelete: (await Promise.all([
76
- cleanupSerializedInputPropsProm,
77
- cleanupResolvedInputPropsProm,
78
- ])).reduce((a, b) => Math.max(a, b), 0),
69
+ timeToDelete: (await cleanupProm).reduce((a, b) => Math.max(a, b), 0),
79
70
  outputFile: {
80
71
  url: outputUrl,
81
72
  },
@@ -15,6 +15,7 @@ const validate_outname_1 = require("../shared/validate-outname");
15
15
  const validate_privacy_1 = require("../shared/validate-privacy");
16
16
  const plan_frame_ranges_1 = require("./chunk-optimization/plan-frame-ranges");
17
17
  const best_frames_per_lambda_param_1 = require("./helpers/best-frames-per-lambda-param");
18
+ const cleanup_props_1 = require("./helpers/cleanup-props");
18
19
  const expected_out_name_1 = require("./helpers/expected-out-name");
19
20
  const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-bucket");
20
21
  const get_browser_instance_1 = require("./helpers/get-browser-instance");
@@ -24,7 +25,7 @@ const overall_render_progress_1 = require("./helpers/overall-render-progress");
24
25
  const stream_renderer_1 = require("./helpers/stream-renderer");
25
26
  const validate_composition_1 = require("./helpers/validate-composition");
26
27
  const write_lambda_error_1 = require("./helpers/write-lambda-error");
27
- const innerLaunchHandler = async ({ functionName, params, options, overallProgress, }) => {
28
+ const innerLaunchHandler = async ({ functionName, params, options, overallProgress, registerCleanupTask, }) => {
28
29
  var _a, _b, _c, _d, _e;
29
30
  if (params.type !== constants_1.LambdaRoutines.launch) {
30
31
  throw new Error('Expected launch type');
@@ -119,6 +120,12 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
119
120
  userSpecifiedBucketName: params.bucketName,
120
121
  needsToUpload,
121
122
  });
123
+ registerCleanupTask(() => {
124
+ return (0, cleanup_props_1.cleanupProps)({
125
+ serializedResolvedProps,
126
+ inputProps: params.inputProps,
127
+ });
128
+ });
122
129
  const fps = comp.fps / params.everyNthFrame;
123
130
  // If for 150 functions, we stream every frame, we DDos ourselves.
124
131
  // Throttling a bit, allowing more progress if there is lower concurrency.
@@ -282,6 +289,10 @@ const launchHandler = async (params, options) => {
282
289
  indent: false,
283
290
  logLevel: params.logLevel,
284
291
  };
292
+ const cleanupTasks = [];
293
+ const registerCleanupTask = (task) => {
294
+ cleanupTasks.push(task);
295
+ };
285
296
  const onTimeout = async () => {
286
297
  var _a;
287
298
  renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Function is about to time out. Can not finish render.');
@@ -291,6 +302,13 @@ const launchHandler = async (params, options) => {
291
302
  if (webhookInvoked) {
292
303
  return;
293
304
  }
305
+ Promise.all(cleanupTasks)
306
+ .then(() => {
307
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'Ran cleanup tasks');
308
+ })
309
+ .catch((err) => {
310
+ renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Failed to run cleanup tasks:', err);
311
+ });
294
312
  try {
295
313
  await (0, invoke_webhook_1.invokeWebhook)({
296
314
  url: params.webhook.url,
@@ -345,6 +363,7 @@ const launchHandler = async (params, options) => {
345
363
  params,
346
364
  options,
347
365
  overallProgress,
366
+ registerCleanupTask,
348
367
  });
349
368
  clearTimeout(webhookDueToTimeout);
350
369
  if (!params.webhook || webhookInvoked) {
@@ -191,7 +191,6 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
191
191
  await Promise.all([
192
192
  node_fs_1.default.promises.rm(outputPath, { recursive: true }),
193
193
  (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
194
- bucketName,
195
194
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
196
195
  serialized: lambdaParams.inputProps,
197
196
  }),
@@ -1,5 +1,5 @@
1
1
  export declare const LambdaInternals: {
2
- executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "verbose" | "info" | "warn") => Promise<void>;
2
+ executeCommand: (args: string[], remotionRoot: string, logLevel: "verbose" | "info" | "warn" | "error") => Promise<void>;
3
3
  makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, }: import("./api/make-lambda-payload").InnerRenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
4
4
  getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, }: import("./client").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
5
5
  makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, }: import("./api/render-still-on-lambda").RenderStillOnLambdaNonNullInput) => Promise<{
@@ -14,7 +14,7 @@ export declare const LambdaInternals: {
14
14
  maxRetries: number;
15
15
  frame: number;
16
16
  privacy: import("./defaults").Privacy;
17
- logLevel: "error" | "verbose" | "info" | "warn";
17
+ logLevel: "verbose" | "info" | "warn" | "error";
18
18
  outName: import("./defaults").OutNameInput | null;
19
19
  timeoutInMilliseconds: number;
20
20
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
@@ -57,11 +57,11 @@ export declare const LambdaInternals: {
57
57
  getValue: ({ commandLine }: {
58
58
  commandLine: Record<string, unknown>;
59
59
  }) => {
60
- value: "error" | "verbose" | "info" | "warn";
60
+ value: "verbose" | "info" | "warn" | "error";
61
61
  source: string;
62
62
  };
63
- setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
64
- type: "error" | "verbose" | "info" | "warn";
63
+ setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
64
+ type: "verbose" | "info" | "warn" | "error";
65
65
  };
66
66
  readonly throwIfSiteExists: {
67
67
  cliFlag: string;
@@ -1,12 +1,10 @@
1
1
  import type { AwsRegion } from '../client';
2
2
  import type { SerializedInputProps } from './constants';
3
- export declare const cleanupSerializedInputProps: ({ serialized, region, bucketName, }: {
3
+ export declare const cleanupSerializedInputProps: ({ serialized, region, }: {
4
4
  serialized: SerializedInputProps;
5
5
  region: AwsRegion;
6
- bucketName: string;
7
6
  }) => Promise<number>;
8
- export declare const cleanupSerializedResolvedProps: ({ serialized, region, bucketName, }: {
7
+ export declare const cleanupSerializedResolvedProps: ({ serialized, region, }: {
9
8
  serialized: SerializedInputProps;
10
9
  region: AwsRegion;
11
- bucketName: string;
12
10
  }) => Promise<number>;
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cleanupSerializedResolvedProps = exports.cleanupSerializedInputProps = void 0;
4
4
  const io_1 = require("../functions/helpers/io");
5
5
  const constants_1 = require("./constants");
6
- const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
6
+ const cleanupSerializedInputProps = async ({ serialized, region, }) => {
7
7
  if (serialized.type === 'payload') {
8
8
  return 0;
9
9
  }
10
10
  const time = Date.now();
11
11
  await (0, io_1.lambdaDeleteFile)({
12
- bucketName,
12
+ bucketName: serialized.bucketName,
13
13
  key: (0, constants_1.inputPropsKey)(serialized.hash),
14
14
  region,
15
15
  customCredentials: null,
@@ -17,13 +17,13 @@ const cleanupSerializedInputProps = async ({ serialized, region, bucketName, })
17
17
  return Date.now() - time;
18
18
  };
19
19
  exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
20
- const cleanupSerializedResolvedProps = async ({ serialized, region, bucketName, }) => {
20
+ const cleanupSerializedResolvedProps = async ({ serialized, region, }) => {
21
21
  if (serialized.type === 'payload') {
22
22
  return 0;
23
23
  }
24
24
  const time = Date.now();
25
25
  await (0, io_1.lambdaDeleteFile)({
26
- bucketName,
26
+ bucketName: serialized.bucketName,
27
27
  key: (0, constants_1.resolvedPropsKey)(serialized.hash),
28
28
  region,
29
29
  customCredentials: null,
@@ -60,6 +60,7 @@ const compressInputProps = async ({ stringifiedInputProps, region, userSpecified
60
60
  return {
61
61
  type: 'bucket-url',
62
62
  hash,
63
+ bucketName,
63
64
  };
64
65
  }
65
66
  return {
@@ -52,7 +52,6 @@ export declare const getSitesKey: (siteId: string) => string;
52
52
  export declare const outName: (renderId: string, extension: string) => string;
53
53
  export declare const outStillName: (renderId: string, imageFormat: StillImageFormat) => string;
54
54
  export declare const customOutName: (renderId: string, bucketName: string, name: OutNameInput) => OutNameOutput;
55
- export declare const defaultPropsKey: (hash: string) => string;
56
55
  export declare const inputPropsKey: (hash: string) => string;
57
56
  export declare const resolvedPropsKey: (hash: string) => string;
58
57
  export declare const RENDERER_PATH_TOKEN = "remotion-bucket";
@@ -80,6 +79,7 @@ export type WebhookOption = Prettify<null | ({
80
79
  export type SerializedInputProps = {
81
80
  type: 'bucket-url';
82
81
  hash: string;
82
+ bucketName: string;
83
83
  } | {
84
84
  type: 'payload';
85
85
  payload: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.defaultPropsKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.overallProgressKey = exports.rendersPrefix = exports.LAMBDA_INSIGHTS_PREFIX = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
3
+ exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.overallProgressKey = exports.rendersPrefix = exports.LAMBDA_INSIGHTS_PREFIX = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
4
4
  exports.MIN_MEMORY = 512;
5
5
  exports.MAX_MEMORY = 10240;
6
6
  exports.DEFAULT_MEMORY_SIZE = 2048;
@@ -49,10 +49,6 @@ const customOutName = (renderId, bucketName, name) => {
49
49
  };
50
50
  };
51
51
  exports.customOutName = customOutName;
52
- const defaultPropsKey = (hash) => {
53
- return `default-props/${hash}.json`;
54
- };
55
- exports.defaultPropsKey = defaultPropsKey;
56
52
  const inputPropsKey = (hash) => {
57
53
  return `input-props/${hash}.json`;
58
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.168",
3
+ "version": "4.0.169",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -22,11 +22,11 @@
22
22
  "@aws-sdk/s3-request-presigner": "3.583.0",
23
23
  "mime-types": "2.1.34",
24
24
  "zod": "3.22.3",
25
- "@remotion/bundler": "4.0.168",
26
- "@remotion/cli": "4.0.168",
27
- "@remotion/streaming": "4.0.168",
28
- "@remotion/renderer": "4.0.168",
29
- "remotion": "4.0.168"
25
+ "@remotion/bundler": "4.0.169",
26
+ "@remotion/cli": "4.0.169",
27
+ "@remotion/renderer": "4.0.169",
28
+ "@remotion/streaming": "4.0.169",
29
+ "remotion": "4.0.169"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@jonny/eslint-config": "3.0.281",
@@ -42,11 +42,11 @@
42
42
  "ts-node": "10.9.2",
43
43
  "vitest": "0.31.1",
44
44
  "zip-lib": "^0.7.2",
45
- "@remotion/bundler": "4.0.168",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.168"
45
+ "@remotion/bundler": "4.0.169",
46
+ "@remotion/compositor-linux-arm64-gnu": "4.0.169"
47
47
  },
48
48
  "peerDependencies": {
49
- "@remotion/bundler": "4.0.168"
49
+ "@remotion/bundler": "4.0.169"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
Binary file