@remotion/lambda 4.0.146 → 4.0.148

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.
@@ -6,7 +6,6 @@ const version_1 = require("remotion/version");
6
6
  const get_regions_1 = require("../api/get-regions");
7
7
  const quit_1 = require("../cli/helpers/quit");
8
8
  const aws_clients_1 = require("../shared/aws-clients");
9
- const runtimes = ['nodejs18.x'];
10
9
  const layerInfo = {
11
10
  'ap-northeast-1': [],
12
11
  'ap-south-1': [],
@@ -30,22 +29,26 @@ const layerInfo = {
30
29
  'sa-east-1': [],
31
30
  'us-west-1': [],
32
31
  };
32
+ const V5_RUNTIME = true;
33
33
  const makeLayerPublic = async () => {
34
- const layers = ['fonts', 'ffmpeg', 'chromium'];
34
+ const runtimes = [V5_RUNTIME ? 'nodejs20.x' : 'nodejs18.x'];
35
+ const layers = ['fonts', 'chromium'];
35
36
  for (const region of (0, get_regions_1.getRegions)()) {
36
37
  for (const layer of layers) {
37
38
  const layerName = `remotion-binaries-${layer}-arm64`;
38
39
  const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
39
40
  Content: {
40
41
  S3Bucket: 'remotionlambda-binaries-' + region,
41
- S3Key: `remotion-layer-${layer}-v10-arm64.zip`,
42
+ S3Key: V5_RUNTIME
43
+ ? `remotion-layer-${layer}-v11-arm64.zip`
44
+ : `remotion-layer-${layer}-v10-arm64.zip`,
42
45
  },
43
46
  LayerName: layerName,
44
47
  LicenseInfo: layer === 'chromium'
45
- ? 'Chromium 114, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
46
- : layer === 'ffmpeg'
47
- ? 'FFmpeg 6.0, compiled from source. Read FFMPEG license: https://ffmpeg.org/legal.html'
48
- : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
48
+ ? V5_RUNTIME
49
+ ? 'Chromium 123.0.6312.86, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
50
+ : 'Chromium 114, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
51
+ : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
49
52
  CompatibleRuntimes: runtimes,
50
53
  Description: version_1.VERSION,
51
54
  }));
@@ -1,5 +1,6 @@
1
+ import type { LogLevel } from '@remotion/renderer';
1
2
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, enableLambdaInsights, }: {
3
+ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, enableLambdaInsights, enableV5Runtime, logLevel, }: {
3
4
  createCloudWatchLogGroup: boolean;
4
5
  region: AwsRegion;
5
6
  zipFile: string;
@@ -12,6 +13,8 @@ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFil
12
13
  ephemerealStorageInMb: number;
13
14
  customRoleArn: string;
14
15
  enableLambdaInsights: boolean;
16
+ enableV5Runtime: boolean;
17
+ logLevel: LogLevel;
15
18
  }) => Promise<{
16
19
  FunctionName: string;
17
20
  }>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFunction = void 0;
4
4
  const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
5
5
  const client_lambda_1 = require("@aws-sdk/client-lambda");
6
+ const renderer_1 = require("@remotion/renderer");
6
7
  const node_fs_1 = require("node:fs");
7
8
  const version_1 = require("remotion/version");
8
9
  const defaults_1 = require("../defaults");
@@ -10,29 +11,44 @@ const aws_clients_1 = require("../shared/aws-clients");
10
11
  const hosted_layers_1 = require("../shared/hosted-layers");
11
12
  const lambda_insights_extensions_1 = require("../shared/lambda-insights-extensions");
12
13
  const suggested_policy_1 = require("./iam-validation/suggested-policy");
13
- const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, enableLambdaInsights, }) => {
14
+ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, enableLambdaInsights, enableV5Runtime, logLevel, }) => {
14
15
  var _a;
15
16
  if (createCloudWatchLogGroup) {
17
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Creating CloudWatch group');
16
18
  try {
17
19
  await (0, aws_clients_1.getCloudWatchLogsClient)(region).send(new client_cloudwatch_logs_1.CreateLogGroupCommand({
18
20
  logGroupName: `${defaults_1.LOG_GROUP_PREFIX}${functionName}`,
19
21
  }));
22
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'CloudWatch group successfully created');
20
23
  }
21
24
  catch (_err) {
22
25
  const err = _err;
23
- if (!err.message.includes('log group already exists')) {
26
+ if (err.message.includes('log group already exists')) {
27
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'CloudWatch group already existed.');
28
+ }
29
+ else {
24
30
  throw err;
25
31
  }
26
32
  }
33
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Adding retention policy to the CloudWatch group');
27
34
  await (0, aws_clients_1.getCloudWatchLogsClient)(region).send(new client_cloudwatch_logs_1.PutRetentionPolicyCommand({
28
35
  logGroupName: `${defaults_1.LOG_GROUP_PREFIX}${functionName}`,
29
36
  retentionInDays,
30
37
  }));
38
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Set retention to ${retentionInDays} days`);
31
39
  }
32
40
  if (alreadyCreated) {
41
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Function ${functionName} already existed`);
33
42
  return { FunctionName: functionName };
34
43
  }
35
44
  const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
45
+ const layers = enableV5Runtime
46
+ ? hosted_layers_1.v5HostedLayers[region]
47
+ : hosted_layers_1.hostedLayers[region];
48
+ if (enableV5Runtime) {
49
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'New V5 runtime enabled https://remotion.dev/docs/lambda/runtime#runtime-changes-in-remotion-50');
50
+ }
51
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Deploying new Lambda function');
36
52
  const { FunctionName, FunctionArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
37
53
  Code: {
38
54
  ZipFile: (0, node_fs_1.readFileSync)(zipFile),
@@ -40,11 +56,11 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
40
56
  FunctionName: functionName,
41
57
  Handler: 'index.handler',
42
58
  Role: customRoleArn !== null && customRoleArn !== void 0 ? customRoleArn : defaultRoleName,
43
- Runtime: 'nodejs18.x',
59
+ Runtime: enableV5Runtime ? 'nodejs20.x' : 'nodejs18.x',
44
60
  Description: 'Renders a Remotion video.',
45
61
  MemorySize: memorySizeInMb,
46
62
  Timeout: timeoutInSeconds,
47
- Layers: hosted_layers_1.hostedLayers[region]
63
+ Layers: layers
48
64
  .map(({ layerArn, version }) => `${layerArn}:${version}`)
49
65
  .concat(enableLambdaInsights ? lambda_insights_extensions_1.lambdaInsightsExtensions[region] : []),
50
66
  Architectures: ['arm64'],
@@ -52,6 +68,7 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
52
68
  Size: ephemerealStorageInMb,
53
69
  },
54
70
  }));
71
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Function deployed. Adding tags...');
55
72
  try {
56
73
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.TagResourceCommand({
57
74
  Resource: FunctionArn,
@@ -66,14 +83,20 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
66
83
  }
67
84
  catch (err) {
68
85
  // Previous Lambda versions had no permission to tag the function
69
- if (!err.name.includes('AccessDenied')) {
86
+ if (err.name.includes('AccessDenied')) {
87
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Did not have permission to tag the function. Skipping.');
88
+ }
89
+ else {
70
90
  throw err;
71
91
  }
72
92
  }
93
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Disabling function retries (Remotion handles retries itself)...');
73
94
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutFunctionEventInvokeConfigCommand({
74
95
  MaximumRetryAttempts: 0,
75
96
  FunctionName,
76
97
  }));
98
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Set function retries to 0.');
99
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Waiting for the function to be ready...');
77
100
  let state = 'Pending';
78
101
  while (state === 'Pending') {
79
102
  const getFn = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.GetFunctionCommand({
@@ -84,16 +107,22 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
84
107
  });
85
108
  state = (_a = getFn.Configuration) === null || _a === void 0 ? void 0 : _a.State;
86
109
  }
110
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Function is now ready.');
111
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Locking the runtime version of the function...');
112
+ const RuntimeVersionArn = enableV5Runtime
113
+ ? `arn:aws:lambda:${region}::runtime:da57c20c4b965d5b75540f6865a35fc8030358e33ec44ecfed33e90901a27a72`
114
+ : `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`;
87
115
  try {
88
116
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutRuntimeManagementConfigCommand({
89
117
  FunctionName,
90
118
  UpdateRuntimeOn: 'Manual',
91
- RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`,
119
+ RuntimeVersionArn,
92
120
  }));
93
121
  }
94
122
  catch (err) {
95
123
  console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking in the future in case the AWS runtime changes. See https://remotion.dev/docs/lambda/feb-2023-incident for an example on how to update your policy.');
96
124
  }
125
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Function runtime is locked to ${RuntimeVersionArn}`);
97
126
  return { FunctionName: FunctionName };
98
127
  };
99
128
  exports.createFunction = createFunction;
@@ -13,12 +13,14 @@ type OptionalParameters = {
13
13
  enableLambdaInsights: boolean;
14
14
  indent: boolean;
15
15
  logLevel: LogLevel;
16
+ enableV5Runtime: boolean;
16
17
  };
17
18
  export type DeployFunctionInput = MandatoryParameters & Partial<OptionalParameters>;
18
19
  export type DeployFunctionOutput = {
19
20
  functionName: string;
20
21
  alreadyExisted: boolean;
21
22
  };
23
+ export declare const internalDeployFunction: (params: MandatoryParameters & OptionalParameters) => Promise<DeployFunctionOutput>;
22
24
  export declare const errorHandled: (params: MandatoryParameters & OptionalParameters) => Promise<DeployFunctionOutput>;
23
25
  /**
24
26
  * @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
@@ -32,5 +34,5 @@ export declare const errorHandled: (params: MandatoryParameters & OptionalParame
32
34
  * @param params.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
33
35
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
34
36
  */
35
- export declare const deployFunction: ({ createCloudWatchLogGroup, memorySizeInMb, region, timeoutInSeconds, cloudWatchLogRetentionPeriodInDays, customRoleArn, enableLambdaInsights, indent, logLevel, ...options }: DeployFunctionInput) => Promise<DeployFunctionOutput>;
37
+ export declare const deployFunction: ({ createCloudWatchLogGroup, memorySizeInMb, region, timeoutInSeconds, cloudWatchLogRetentionPeriodInDays, customRoleArn, enableLambdaInsights, indent, logLevel, enableV5Runtime, ...options }: DeployFunctionInput) => Promise<DeployFunctionOutput>;
36
38
  export {};
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deployFunction = exports.errorHandled = void 0;
3
+ exports.deployFunction = exports.errorHandled = exports.internalDeployFunction = void 0;
4
4
  const pure_1 = require("@remotion/renderer/pure");
5
+ const no_react_1 = require("remotion/no-react");
5
6
  const version_1 = require("remotion/version");
6
7
  const get_functions_1 = require("../api/get-functions");
7
8
  const constants_1 = require("../shared/constants");
@@ -51,6 +52,8 @@ const internalDeployFunction = async (params) => {
51
52
  ephemerealStorageInMb: params.diskSizeInMb,
52
53
  customRoleArn: params.customRoleArn,
53
54
  enableLambdaInsights: (_b = params.enableLambdaInsights) !== null && _b !== void 0 ? _b : false,
55
+ enableV5Runtime: params.enableV5Runtime,
56
+ logLevel: params.logLevel,
54
57
  });
55
58
  if (!created.FunctionName) {
56
59
  throw new Error('Lambda was created but has no name');
@@ -60,7 +63,8 @@ const internalDeployFunction = async (params) => {
60
63
  alreadyExisted: Boolean(alreadyDeployed),
61
64
  };
62
65
  };
63
- exports.errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(internalDeployFunction);
66
+ exports.internalDeployFunction = internalDeployFunction;
67
+ exports.errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(exports.internalDeployFunction);
64
68
  /**
65
69
  * @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
66
70
  * @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
@@ -73,7 +77,7 @@ exports.errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(internalDeployFu
73
77
  * @param params.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
74
78
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
75
79
  */
76
- const deployFunction = ({ createCloudWatchLogGroup, memorySizeInMb, region, timeoutInSeconds, cloudWatchLogRetentionPeriodInDays, customRoleArn, enableLambdaInsights, indent, logLevel, ...options }) => {
80
+ const deployFunction = ({ createCloudWatchLogGroup, memorySizeInMb, region, timeoutInSeconds, cloudWatchLogRetentionPeriodInDays, customRoleArn, enableLambdaInsights, indent, logLevel, enableV5Runtime, ...options }) => {
77
81
  var _a;
78
82
  const diskSizeInMb = (_a = options.diskSizeInMb) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
79
83
  return (0, exports.errorHandled)({
@@ -87,6 +91,7 @@ const deployFunction = ({ createCloudWatchLogGroup, memorySizeInMb, region, time
87
91
  region,
88
92
  timeoutInSeconds,
89
93
  cloudWatchLogRetentionPeriodInDays,
94
+ enableV5Runtime: enableV5Runtime !== null && enableV5Runtime !== void 0 ? enableV5Runtime : no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES,
90
95
  });
91
96
  };
92
97
  exports.deployFunction = deployFunction;
@@ -46,7 +46,7 @@ export type InnerRenderMediaOnLambdaInput = {
46
46
  rendererFunctionName: string | null;
47
47
  forceBucketName: string | null;
48
48
  audioCodec: AudioCodec | null;
49
- colorSpace: ColorSpace;
49
+ colorSpace: ColorSpace | null;
50
50
  deleteAfter: DeleteAfter | null;
51
51
  indent: boolean;
52
52
  } & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
@@ -69,7 +69,7 @@ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange,
69
69
  type: defaults_1.LambdaRoutines.start,
70
70
  offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
71
71
  deleteAfter: deleteAfter !== null && deleteAfter !== void 0 ? deleteAfter : null,
72
- colorSpace: colorSpace !== null && colorSpace !== void 0 ? colorSpace : 'default',
72
+ colorSpace: colorSpace !== null && colorSpace !== void 0 ? colorSpace : null,
73
73
  preferLossless: preferLossless !== null && preferLossless !== void 0 ? preferLossless : false,
74
74
  };
75
75
  };
@@ -55,7 +55,7 @@ const renderMediaOnLambdaOptionalToRequired = (options) => {
55
55
  audioCodec: (_b = options.audioCodec) !== null && _b !== void 0 ? _b : null,
56
56
  chromiumOptions: (_c = options.chromiumOptions) !== null && _c !== void 0 ? _c : {},
57
57
  codec: options.codec,
58
- colorSpace: (_d = options.colorSpace) !== null && _d !== void 0 ? _d : 'default',
58
+ colorSpace: (_d = options.colorSpace) !== null && _d !== void 0 ? _d : null,
59
59
  composition: options.composition,
60
60
  concurrencyPerLambda: (_e = options.concurrencyPerLambda) !== null && _e !== void 0 ? _e : 1,
61
61
  crf: options.crf,
@@ -13,7 +13,7 @@ const args_1 = require("../../args");
13
13
  const get_aws_region_1 = require("../../get-aws-region");
14
14
  exports.FUNCTIONS_DEPLOY_SUBCOMMAND = 'deploy';
15
15
  const functionsDeploySubcommand = async (logLevel) => {
16
- var _a, _b, _c, _d, _e, _f;
16
+ var _a, _b, _c, _d, _e, _f, _g;
17
17
  const region = (0, get_aws_region_1.getAwsRegion)();
18
18
  const timeoutInSeconds = (_a = args_1.parsedLambdaCli.timeout) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_TIMEOUT;
19
19
  const memorySizeInMb = (_b = args_1.parsedLambdaCli.memory) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MEMORY_SIZE;
@@ -22,6 +22,7 @@ const functionsDeploySubcommand = async (logLevel) => {
22
22
  const createCloudWatchLogGroup = !args_1.parsedLambdaCli['disable-cloudwatch'];
23
23
  const enableLambdaInsights = (_e = args_1.parsedLambdaCli['enable-lambda-insights']) !== null && _e !== void 0 ? _e : false;
24
24
  const cloudWatchLogRetentionPeriodInDays = (_f = args_1.parsedLambdaCli['retention-period']) !== null && _f !== void 0 ? _f : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD;
25
+ const enableV5Runtime = (_g = args_1.parsedLambdaCli['enable-v5-runtime']) !== null && _g !== void 0 ? _g : undefined;
25
26
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
26
27
  (0, validate_timeout_1.validateTimeout)(timeoutInSeconds);
27
28
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
@@ -46,7 +47,7 @@ Lambda Insights Enabled = ${enableLambdaInsights}
46
47
  indent: false,
47
48
  });
48
49
  output.update('Deploying Lambda...', false);
49
- const { functionName, alreadyExisted } = await (0, deploy_function_1.deployFunction)({
50
+ const { functionName, alreadyExisted } = await (0, deploy_function_1.internalDeployFunction)({
50
51
  createCloudWatchLogGroup,
51
52
  region,
52
53
  timeoutInSeconds,
@@ -55,6 +56,9 @@ Lambda Insights Enabled = ${enableLambdaInsights}
55
56
  diskSizeInMb,
56
57
  customRoleArn,
57
58
  enableLambdaInsights,
59
+ enableV5Runtime,
60
+ indent: false,
61
+ logLevel,
58
62
  });
59
63
  if (cli_1.CliInternals.quietFlagProvided()) {
60
64
  cli_1.CliInternals.Log.info({ indent: false, logLevel }, functionName);
@@ -2,8 +2,7 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.executablePath = void 0;
5
- if (/^AWS_Lambda_nodejs(?:18)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') ===
6
- true) {
5
+ if (/^AWS_Lambda_nodejs(?:18|20)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') === true) {
7
6
  process.env.FONTCONFIG_PATH = '/opt';
8
7
  process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
9
8
  process.env.DISABLE_FROM_SURFACE = '1';
@@ -1 +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";
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";
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
4
4
  type: z.ZodLiteral<"render-id-determined">;
5
5
  renderId: z.ZodString;
6
6
  }, "strip", z.ZodTypeAny, {
7
- type: "render-id-determined";
8
7
  renderId: string;
9
- }, {
10
8
  type: "render-id-determined";
9
+ }, {
11
10
  renderId: string;
11
+ type: "render-id-determined";
12
12
  }>]>;
13
13
  export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
14
14
  export declare const isStreamingPayload: (str: string) => false | {
15
- type: "render-id-determined";
16
15
  renderId: string;
16
+ type: "render-id-determined";
17
17
  };
18
18
  export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
19
19
  export {};
@@ -384,6 +384,7 @@ const launchHandler = async (params, options) => {
384
384
  bucketName: params.bucketName,
385
385
  customData: (_a = params.webhook.customData) !== null && _a !== void 0 ? _a : null,
386
386
  },
387
+ redirectsSoFar: 0,
387
388
  }, params.logLevel);
388
389
  webhookInvoked = true;
389
390
  }
@@ -452,6 +453,7 @@ const launchHandler = async (params, options) => {
452
453
  timeToFinish: postRenderData.timeToFinish,
453
454
  costs: postRenderData.cost,
454
455
  },
456
+ redirectsSoFar: 0,
455
457
  }, params.logLevel);
456
458
  webhookInvoked = true;
457
459
  }
@@ -526,6 +528,7 @@ const launchHandler = async (params, options) => {
526
528
  stack: e.stack,
527
529
  })),
528
530
  },
531
+ redirectsSoFar: 0,
529
532
  }, params.logLevel);
530
533
  webhookInvoked = true;
531
534
  }
@@ -157,7 +157,7 @@ export type LambdaStartPayload = {
157
157
  bucketName: string | null;
158
158
  offthreadVideoCacheSizeInBytes: number | null;
159
159
  deleteAfter: DeleteAfter | null;
160
- colorSpace: ColorSpace;
160
+ colorSpace: ColorSpace | null;
161
161
  preferLossless: boolean;
162
162
  };
163
163
  export type LambdaStatusPayload = {
@@ -215,7 +215,7 @@ export type LambdaPayloads = {
215
215
  forceWidth: number | null;
216
216
  offthreadVideoCacheSizeInBytes: number | null;
217
217
  deleteAfter: DeleteAfter | null;
218
- colorSpace: ColorSpace;
218
+ colorSpace: ColorSpace | null;
219
219
  preferLossless: boolean;
220
220
  };
221
221
  status: LambdaStatusPayload;
@@ -261,7 +261,7 @@ export type LambdaPayloads = {
261
261
  preferLossless: boolean;
262
262
  offthreadVideoCacheSizeInBytes: number | null;
263
263
  deleteAfter: DeleteAfter | null;
264
- colorSpace: ColorSpace;
264
+ colorSpace: ColorSpace | null;
265
265
  compositionStart: number;
266
266
  framesPerLambda: number;
267
267
  };
@@ -7,3 +7,4 @@ export type HostedLayers = {
7
7
  }[];
8
8
  };
9
9
  export declare const hostedLayers: HostedLayers;
10
+ export declare const v5HostedLayers: HostedLayers;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hostedLayers = exports.REMOTION_HOSTED_LAYER_ARN = void 0;
3
+ exports.v5HostedLayers = exports.hostedLayers = exports.REMOTION_HOSTED_LAYER_ARN = void 0;
4
4
  exports.REMOTION_HOSTED_LAYER_ARN = `arn:aws:lambda:*:678892195805:layer:remotion-binaries-*`;
5
5
  exports.hostedLayers = {
6
6
  'ap-northeast-1': [
@@ -214,3 +214,215 @@ exports.hostedLayers = {
214
214
  },
215
215
  ],
216
216
  };
217
+ exports.v5HostedLayers = {
218
+ 'ap-northeast-1': [
219
+ {
220
+ layerArn: 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
221
+ version: 11,
222
+ },
223
+ {
224
+ layerArn: 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
225
+ version: 15,
226
+ },
227
+ ],
228
+ 'ap-south-1': [
229
+ {
230
+ layerArn: 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
231
+ version: 11,
232
+ },
233
+ {
234
+ layerArn: 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
235
+ version: 15,
236
+ },
237
+ ],
238
+ 'ap-southeast-1': [
239
+ {
240
+ layerArn: 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
241
+ version: 11,
242
+ },
243
+ {
244
+ layerArn: 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
245
+ version: 15,
246
+ },
247
+ ],
248
+ 'ap-southeast-2': [
249
+ {
250
+ layerArn: 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
251
+ version: 11,
252
+ },
253
+ {
254
+ layerArn: 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
255
+ version: 15,
256
+ },
257
+ ],
258
+ 'eu-central-1': [
259
+ {
260
+ layerArn: 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
261
+ version: 34,
262
+ },
263
+ {
264
+ layerArn: 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
265
+ version: 35,
266
+ },
267
+ ],
268
+ 'eu-west-1': [
269
+ {
270
+ layerArn: 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
271
+ version: 12,
272
+ },
273
+ {
274
+ layerArn: 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
275
+ version: 15,
276
+ },
277
+ ],
278
+ 'eu-west-2': [
279
+ {
280
+ layerArn: 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
281
+ version: 11,
282
+ },
283
+ {
284
+ layerArn: 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
285
+ version: 15,
286
+ },
287
+ ],
288
+ 'us-east-1': [
289
+ {
290
+ layerArn: 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
291
+ version: 16,
292
+ },
293
+ {
294
+ layerArn: 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
295
+ version: 24,
296
+ },
297
+ ],
298
+ 'us-east-2': [
299
+ {
300
+ layerArn: 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-fonts-arm64',
301
+ version: 11,
302
+ },
303
+ {
304
+ layerArn: 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-chromium-arm64',
305
+ version: 15,
306
+ },
307
+ ],
308
+ 'us-west-2': [
309
+ {
310
+ layerArn: 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
311
+ version: 11,
312
+ },
313
+ {
314
+ layerArn: 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
315
+ version: 15,
316
+ },
317
+ ],
318
+ 'af-south-1': [
319
+ {
320
+ layerArn: 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
321
+ version: 8,
322
+ },
323
+ {
324
+ layerArn: 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
325
+ version: 8,
326
+ },
327
+ ],
328
+ 'ap-east-1': [
329
+ {
330
+ layerArn: 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
331
+ version: 8,
332
+ },
333
+ {
334
+ layerArn: 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
335
+ version: 8,
336
+ },
337
+ ],
338
+ 'ap-northeast-2': [
339
+ {
340
+ layerArn: 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
341
+ version: 8,
342
+ },
343
+ {
344
+ layerArn: 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
345
+ version: 8,
346
+ },
347
+ ],
348
+ 'ap-northeast-3': [
349
+ {
350
+ layerArn: 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-fonts-arm64',
351
+ version: 8,
352
+ },
353
+ {
354
+ layerArn: 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-chromium-arm64',
355
+ version: 8,
356
+ },
357
+ ],
358
+ 'ca-central-1': [
359
+ {
360
+ layerArn: 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
361
+ version: 8,
362
+ },
363
+ {
364
+ layerArn: 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
365
+ version: 8,
366
+ },
367
+ ],
368
+ 'eu-north-1': [
369
+ {
370
+ layerArn: 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-fonts-arm64',
371
+ version: 8,
372
+ },
373
+ {
374
+ layerArn: 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-chromium-arm64',
375
+ version: 8,
376
+ },
377
+ ],
378
+ 'eu-south-1': [
379
+ {
380
+ layerArn: 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
381
+ version: 8,
382
+ },
383
+ {
384
+ layerArn: 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
385
+ version: 8,
386
+ },
387
+ ],
388
+ 'eu-west-3': [
389
+ {
390
+ layerArn: 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-fonts-arm64',
391
+ version: 8,
392
+ },
393
+ {
394
+ layerArn: 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-chromium-arm64',
395
+ version: 8,
396
+ },
397
+ ],
398
+ 'me-south-1': [
399
+ {
400
+ layerArn: 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
401
+ version: 8,
402
+ },
403
+ {
404
+ layerArn: 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
405
+ version: 8,
406
+ },
407
+ ],
408
+ 'sa-east-1': [
409
+ {
410
+ layerArn: 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
411
+ version: 8,
412
+ },
413
+ {
414
+ layerArn: 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
415
+ version: 8,
416
+ },
417
+ ],
418
+ 'us-west-1': [
419
+ {
420
+ layerArn: 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
421
+ version: 8,
422
+ },
423
+ {
424
+ layerArn: 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
425
+ version: 8,
426
+ },
427
+ ],
428
+ };
@@ -44,6 +44,7 @@ type InvokeWebhookOptions = {
44
44
  payload: WebhookPayload;
45
45
  url: string;
46
46
  secret: string | null;
47
+ redirectsSoFar: number;
47
48
  };
48
49
  export declare const invokeWebhook: (options: InvokeWebhookOptions, logLevel: LogLevel, retries?: number, errors?: number) => Promise<void>;
49
50
  export {};
@@ -51,6 +51,9 @@ exports.mockableHttpClients = {
51
51
  http: node_http_1.default.request,
52
52
  https: https_1.default.request,
53
53
  };
54
+ // Don't handle 304 status code (Not Modified) as a redirect,
55
+ // since the browser will display the right page.
56
+ const redirectStatusCodes = [301, 302, 303, 307, 308];
54
57
  const getWebhookClient = (url) => {
55
58
  if (url.startsWith('https://')) {
56
59
  return exports.mockableHttpClients.https;
@@ -60,7 +63,7 @@ const getWebhookClient = (url) => {
60
63
  }
61
64
  throw new Error('Can only request URLs starting with http:// or https://');
62
65
  };
63
- function invokeWebhookRaw({ payload, secret, url, }) {
66
+ function invokeWebhookRaw({ payload, secret, url, redirectsSoFar, }) {
64
67
  const jsonPayload = JSON.stringify(payload);
65
68
  return new Promise((resolve, reject) => {
66
69
  const req = getWebhookClient(url)(url, {
@@ -75,6 +78,25 @@ function invokeWebhookRaw({ payload, secret, url, }) {
75
78
  timeout: 5000,
76
79
  }, (res) => {
77
80
  if (res.statusCode && res.statusCode > 299) {
81
+ if (redirectStatusCodes.includes(res.statusCode)) {
82
+ if (!res.headers.location) {
83
+ reject(new Error(`Received a status code ${res.statusCode} but no "Location" header while calling ${res.headers.location}`));
84
+ return;
85
+ }
86
+ if (redirectsSoFar > 10) {
87
+ reject(new Error(`Too many redirects while downloading ${url}`));
88
+ return;
89
+ }
90
+ invokeWebhookRaw({
91
+ payload,
92
+ secret,
93
+ url: res.headers.location,
94
+ redirectsSoFar: redirectsSoFar + 1,
95
+ })
96
+ .then(resolve)
97
+ .catch(reject);
98
+ return;
99
+ }
78
100
  reject(new Error(`Sent a webhook to ${url} but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
79
101
  return;
80
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.146",
3
+ "version": "4.0.148",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,17 +26,17 @@
26
26
  "aws-policies": "^1.0.1",
27
27
  "mime-types": "2.1.34",
28
28
  "zod": "3.22.3",
29
- "@remotion/bundler": "4.0.146",
30
- "@remotion/cli": "4.0.146",
31
- "@remotion/renderer": "4.0.146",
32
- "remotion": "4.0.146"
29
+ "@remotion/bundler": "4.0.148",
30
+ "@remotion/renderer": "4.0.148",
31
+ "remotion": "4.0.148",
32
+ "@remotion/cli": "4.0.148"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jonny/eslint-config": "3.0.281",
36
36
  "@types/mime-types": "2.1.1",
37
37
  "@types/minimist": "1.2.2",
38
38
  "@types/node": "18.14.6",
39
- "@types/react": "18.2.48",
39
+ "@types/react": "18.3.1",
40
40
  "@types/prompt": "^1.1.0",
41
41
  "eslint": "8.56.0",
42
42
  "prettier": "3.2.5",
@@ -45,11 +45,11 @@
45
45
  "ts-node": "10.9.2",
46
46
  "vitest": "0.31.1",
47
47
  "zip-lib": "^0.7.2",
48
- "@remotion/bundler": "4.0.146",
49
- "@remotion/compositor-linux-arm64-gnu": "4.0.146"
48
+ "@remotion/compositor-linux-arm64-gnu": "4.0.148",
49
+ "@remotion/bundler": "4.0.148"
50
50
  },
51
51
  "peerDependencies": {
52
- "@remotion/bundler": "4.0.146"
52
+ "@remotion/bundler": "4.0.148"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
Binary file
@@ -1,2 +0,0 @@
1
- export declare const nssConfigFile: () => string;
2
- export declare const initNss: () => void;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.initNss = exports.nssConfigFile = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = __importDefault(require("path"));
9
- // /etc/pki/pkcs11.txt
10
- const nssConfigFile = () => {
11
- return `
12
- library=libnsssysinit.so
13
- name=NSS Internal PKCS #11 Module
14
- parameters=configdir='sql:/tmp/.pki/nssdb' certPrefix='' keyPrefix='' secmod='secmod.db' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
15
- NSS=Flags=internal,moduleDBOnly,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
16
- `.trim();
17
- };
18
- exports.nssConfigFile = nssConfigFile;
19
- const TARGET_DIR = '/tmp/.pki/nssdb';
20
- const TARGET_FILE = path_1.default.join(TARGET_DIR, 'pkcs11.txt');
21
- const TARGET_CERT_DB = path_1.default.join(TARGET_DIR, 'cert9.db');
22
- const TARGET_KEY_DB = path_1.default.join(TARGET_DIR, 'key4.db');
23
- const initNss = () => {
24
- if (!(0, fs_1.existsSync)(TARGET_DIR)) {
25
- (0, fs_1.mkdirSync)(TARGET_DIR, { recursive: true });
26
- }
27
- if (!(0, fs_1.existsSync)(TARGET_FILE)) {
28
- const nssConfig = (0, exports.nssConfigFile)();
29
- (0, fs_1.writeFileSync)(TARGET_FILE, nssConfig);
30
- }
31
- if (!(0, fs_1.existsSync)(TARGET_CERT_DB)) {
32
- (0, fs_1.cpSync)('/opt/nss/cert9.db', TARGET_CERT_DB);
33
- }
34
- if (!(0, fs_1.existsSync)(TARGET_KEY_DB)) {
35
- (0, fs_1.cpSync)('/opt/nss/key4.db', TARGET_KEY_DB);
36
- }
37
- console.log('Written!');
38
- };
39
- exports.initNss = initNss;