@remotion/lambda 4.0.0-alpha.217 → 4.0.0-alpha4

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 (65) hide show
  1. package/dist/admin/bundle-lambda.js +20 -15
  2. package/dist/admin/make-layer-public.js +87 -60
  3. package/dist/api/clean-items.js +1 -1
  4. package/dist/api/create-bucket.js +34 -1
  5. package/dist/api/create-function.d.ts +3 -1
  6. package/dist/api/create-function.js +4 -4
  7. package/dist/api/deploy-function.d.ts +3 -0
  8. package/dist/api/deploy-function.js +7 -1
  9. package/dist/api/deploy-site.js +8 -3
  10. package/dist/api/download-media.d.ts +4 -0
  11. package/dist/api/download-media.js +5 -1
  12. package/dist/api/estimate-price.d.ts +3 -1
  13. package/dist/api/estimate-price.js +9 -3
  14. package/dist/api/get-compositions-on-lambda.d.ts +2 -2
  15. package/dist/api/get-or-create-bucket.d.ts +1 -0
  16. package/dist/api/get-or-create-bucket.js +3 -0
  17. package/dist/api/iam-validation/simulate.js +2 -4
  18. package/dist/api/iam-validation/user-permissions.js +2 -0
  19. package/dist/api/render-media-on-lambda.d.ts +6 -10
  20. package/dist/api/render-media-on-lambda.js +3 -6
  21. package/dist/api/render-still-on-lambda.d.ts +3 -7
  22. package/dist/api/render-still-on-lambda.js +3 -6
  23. package/dist/cli/args.d.ts +2 -0
  24. package/dist/cli/commands/functions/deploy.js +9 -7
  25. package/dist/cli/commands/functions/ls.js +1 -4
  26. package/dist/cli/commands/functions/rm.js +2 -8
  27. package/dist/cli/commands/functions/rmall.js +2 -8
  28. package/dist/cli/commands/render/render.js +12 -22
  29. package/dist/cli/commands/sites/create.js +8 -7
  30. package/dist/cli/commands/sites/index.js +3 -0
  31. package/dist/cli/commands/still.js +5 -7
  32. package/dist/cli/helpers/progress-bar.d.ts +2 -1
  33. package/dist/cli/helpers/progress-bar.js +7 -3
  34. package/dist/cli/log.d.ts +0 -12
  35. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
  36. package/dist/functions/compositions.d.ts +1 -1
  37. package/dist/functions/compositions.js +2 -0
  38. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +3 -1
  39. package/dist/functions/helpers/calculate-price-from-bucket.js +2 -1
  40. package/dist/functions/helpers/concat-videos.d.ts +4 -2
  41. package/dist/functions/helpers/concat-videos.js +5 -2
  42. package/dist/functions/helpers/create-post-render-data.js +2 -0
  43. package/dist/functions/helpers/get-progress.js +2 -0
  44. package/dist/functions/helpers/is-enosp-err.js +1 -1
  45. package/dist/functions/helpers/validate-composition.d.ts +5 -3
  46. package/dist/functions/helpers/validate-composition.js +3 -1
  47. package/dist/functions/index.d.ts +4 -15
  48. package/dist/functions/index.js +1 -1
  49. package/dist/functions/launch.js +6 -2
  50. package/dist/functions/renderer.js +9 -9
  51. package/dist/functions/start.js +1 -1
  52. package/dist/functions/still.js +5 -1
  53. package/dist/index.d.ts +6 -5
  54. package/dist/index.js +2 -1
  55. package/dist/shared/constants.d.ts +17 -20
  56. package/dist/shared/constants.js +2 -1
  57. package/dist/shared/function-zip-path.d.ts +1 -0
  58. package/dist/shared/function-zip-path.js +2 -1
  59. package/dist/shared/hosted-layers.d.ts +91 -2
  60. package/dist/shared/hosted-layers.js +300 -1
  61. package/dist/shared/invoke-webhook.d.ts +2 -0
  62. package/package.json +89 -90
  63. package/remotionlambda-arm64.zip +0 -0
  64. package/remotionlambda-x64.zip +0 -0
  65. package/remotionlambda.zip +0 -0
@@ -5,45 +5,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bundler_1 = require("@remotion/bundler");
7
7
  const compositor_linux_arm64_musl_1 = require("@remotion/compositor-linux-arm64-musl");
8
+ const compositor_linux_x64_musl_1 = require("@remotion/compositor-linux-x64-musl");
8
9
  const fs_1 = __importDefault(require("fs"));
9
10
  const path_1 = __importDefault(require("path"));
10
11
  const quit_1 = require("../cli/helpers/quit");
11
12
  const function_zip_path_1 = require("../shared/function-zip-path");
12
13
  const zl = require("zip-lib");
13
- const bundleLambda = async () => {
14
+ const bundleLambda = async (arch) => {
15
+ var _a;
14
16
  const outdir = path_1.default.join(__dirname, '..', `build-render`);
15
17
  fs_1.default.mkdirSync(outdir, {
16
18
  recursive: true,
17
19
  });
18
20
  const outfile = path_1.default.join(outdir, 'index.js');
19
- fs_1.default.rmSync(outdir, { recursive: true });
21
+ ((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(outdir, { recursive: true });
20
22
  fs_1.default.mkdirSync(outdir, { recursive: true });
21
23
  const template = require.resolve(path_1.default.join(__dirname, '..', 'functions', 'index'));
22
24
  await bundler_1.BundlerInternals.esbuild.build({
23
25
  platform: 'node',
24
- target: 'node16',
26
+ target: 'node14',
25
27
  bundle: true,
26
28
  outfile,
27
29
  entryPoints: [template],
28
30
  treeShaking: true,
29
- external: [
30
- './compositor',
31
- './compositor.exe',
32
- './ffmpeg/remotion/bin/ffprobe',
33
- './ffmpeg/remotion/bin/ffprobe.exe',
34
- './ffmpeg/remotion/bin/ffmpeg',
35
- './ffmpeg/remotion/bin/ffmpeg.exe',
36
- ],
31
+ external: ['./compositor', './compositor.exe'],
37
32
  });
38
33
  const compositorFile = `${outdir}/compositor`;
39
- fs_1.default.copyFileSync(compositor_linux_arm64_musl_1.binaryPath, compositorFile);
40
- await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
34
+ if (arch === 'arm64') {
35
+ fs_1.default.copyFileSync(compositor_linux_arm64_musl_1.binaryPath, compositorFile);
36
+ await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
37
+ }
38
+ else {
39
+ fs_1.default.copyFileSync(compositor_linux_x64_musl_1.binaryPath, compositorFile);
40
+ await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_X86_64);
41
+ }
41
42
  fs_1.default.unlinkSync(compositorFile);
42
43
  fs_1.default.unlinkSync(outfile);
43
44
  };
44
- bundleLambda()
45
+ bundleLambda('arm64')
45
46
  .then(() => {
46
- console.log('Bundled Lambda');
47
+ console.log('Lambda bundled for arm64');
48
+ return bundleLambda('x86_64');
49
+ })
50
+ .then(() => {
51
+ console.log('Lambda bundled for x86_64');
47
52
  })
48
53
  .catch((err) => {
49
54
  console.log(err);
@@ -6,71 +6,98 @@ 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'];
9
+ const runtimes = ['nodejs14.x'];
10
+ const archictures = ['arm64', 'x86_64'];
10
11
  const layerInfo = {
11
- 'ap-northeast-1': [],
12
- 'ap-south-1': [],
13
- 'ap-southeast-1': [],
14
- 'ap-southeast-2': [],
15
- 'eu-central-1': [],
16
- 'eu-west-1': [],
17
- 'eu-west-2': [],
18
- 'us-east-1': [],
19
- 'us-east-2': [],
20
- 'us-west-2': [],
21
- 'af-south-1': [],
22
- 'ap-east-1': [],
23
- 'ap-northeast-2': [],
24
- 'ap-northeast-3': [],
25
- 'ca-central-1': [],
26
- 'eu-north-1': [],
27
- 'eu-south-1': [],
28
- 'eu-west-3': [],
29
- 'me-south-1': [],
30
- 'sa-east-1': [],
31
- 'us-west-1': [],
12
+ arm64: {
13
+ 'ap-northeast-1': [],
14
+ 'ap-south-1': [],
15
+ 'ap-southeast-1': [],
16
+ 'ap-southeast-2': [],
17
+ 'eu-central-1': [],
18
+ 'eu-west-1': [],
19
+ 'eu-west-2': [],
20
+ 'us-east-1': [],
21
+ 'us-east-2': [],
22
+ 'us-west-2': [],
23
+ 'af-south-1': [],
24
+ 'ap-east-1': [],
25
+ 'ap-northeast-2': [],
26
+ 'ap-northeast-3': [],
27
+ 'ca-central-1': [],
28
+ 'eu-north-1': [],
29
+ 'eu-south-1': [],
30
+ 'eu-west-3': [],
31
+ 'me-south-1': [],
32
+ 'sa-east-1': [],
33
+ 'us-west-1': [],
34
+ },
35
+ x86_64: {
36
+ 'ap-northeast-1': [],
37
+ 'ap-south-1': [],
38
+ 'ap-southeast-1': [],
39
+ 'ap-southeast-2': [],
40
+ 'eu-central-1': [],
41
+ 'eu-west-1': [],
42
+ 'eu-west-2': [],
43
+ 'us-east-1': [],
44
+ 'us-east-2': [],
45
+ 'us-west-2': [],
46
+ 'af-south-1': [],
47
+ 'ap-east-1': [],
48
+ 'ap-northeast-2': [],
49
+ 'ap-northeast-3': [],
50
+ 'ca-central-1': [],
51
+ 'eu-north-1': [],
52
+ 'eu-south-1': [],
53
+ 'eu-west-3': [],
54
+ 'me-south-1': [],
55
+ 'sa-east-1': [],
56
+ 'us-west-1': [],
57
+ },
32
58
  };
33
- const architecture = 'arm64';
34
59
  const makeLayerPublic = async () => {
35
60
  const layers = ['fonts', 'ffmpeg', 'chromium'];
36
- for (const region of (0, get_regions_1.getRegions)()) {
37
- for (const layer of layers) {
38
- const layerName = `remotion-binaries-${layer}-${architecture}`;
39
- const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
40
- Content: {
41
- S3Bucket: 'remotionlambda-binaries-' + region,
42
- S3Key: `remotion-layer-${layer}-v9-${architecture}.zip`,
43
- },
44
- LayerName: layerName,
45
- LicenseInfo: layer === 'chromium'
46
- ? 'Chromium 104, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
47
- : layer === 'ffmpeg'
48
- ? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html'
49
- : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
50
- CompatibleRuntimes: runtimes,
51
- Description: version_1.VERSION,
52
- }));
53
- await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
54
- Action: aws_policies_1.lambda.GetLayerVersion,
55
- LayerName: layerName,
56
- Principal: '*',
57
- VersionNumber: Version,
58
- StatementId: 'public-layer',
59
- }));
60
- if (!layerInfo[region]) {
61
- layerInfo[region] = [];
61
+ for (const architecture of archictures) {
62
+ for (const region of (0, get_regions_1.getRegions)()) {
63
+ for (const layer of layers) {
64
+ const layerName = `remotion-binaries-${layer}-${architecture}`;
65
+ const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
66
+ Content: {
67
+ S3Bucket: 'remotionlambda-binaries-' + region,
68
+ S3Key: `remotion-layer-${layer}-v9-${architecture}.zip`,
69
+ },
70
+ LayerName: layerName,
71
+ LicenseInfo: layer === 'chromium'
72
+ ? 'Chromium 104, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
73
+ : layer === 'ffmpeg'
74
+ ? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html'
75
+ : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
76
+ CompatibleRuntimes: runtimes,
77
+ Description: version_1.VERSION,
78
+ }));
79
+ await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
80
+ Action: aws_policies_1.lambda.GetLayerVersion,
81
+ LayerName: layerName,
82
+ Principal: '*',
83
+ VersionNumber: Version,
84
+ StatementId: 'public-layer',
85
+ }));
86
+ if (!layerInfo[architecture][region]) {
87
+ layerInfo[architecture][region] = [];
88
+ }
89
+ if (!LayerArn) {
90
+ throw new Error('layerArn is null');
91
+ }
92
+ if (!Version) {
93
+ throw new Error('Version is null');
94
+ }
95
+ layerInfo[architecture][region].push({
96
+ layerArn: LayerArn,
97
+ version: Version,
98
+ });
99
+ console.log({ LayerArn, Version });
62
100
  }
63
- if (!LayerArn) {
64
- throw new Error('layerArn is null');
65
- }
66
- if (!Version) {
67
- throw new Error('Version is null');
68
- }
69
- layerInfo[region].push({
70
- layerArn: LayerArn,
71
- version: Version,
72
- });
73
- console.log({ LayerArn, Version });
74
101
  }
75
102
  }
76
103
  };
@@ -5,7 +5,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  const aws_clients_1 = require("../shared/aws-clients");
6
6
  const p_limit_1 = require("../shared/p-limit");
7
7
  const limit = (0, p_limit_1.pLimit)(10);
8
- const cleanItems = ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, }) => {
8
+ const cleanItems = async ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, }) => {
9
9
  return Promise.all(list.map((object) => limit(async () => {
10
10
  onBeforeItemDeleted({
11
11
  bucketName: bucket,
@@ -6,7 +6,40 @@ const aws_clients_1 = require("../shared/aws-clients");
6
6
  const createBucket = async ({ region, bucketName, }) => {
7
7
  await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.CreateBucketCommand({
8
8
  Bucket: bucketName,
9
- ACL: 'public-read',
10
9
  }));
10
+ try {
11
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.DeleteBucketOwnershipControlsCommand({
12
+ Bucket: bucketName,
13
+ }));
14
+ }
15
+ catch (err) {
16
+ if (err.message.includes('Access Denied')) {
17
+ throw new Error('Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
18
+ }
19
+ throw err;
20
+ }
21
+ try {
22
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.DeletePublicAccessBlockCommand({
23
+ Bucket: bucketName,
24
+ }));
25
+ }
26
+ catch (err) {
27
+ if (err.message.includes('Access Denied')) {
28
+ throw new Error('PARTIAL SUCCESS: The s3:PutBucketOwnershipControls was found, but the s3:PutBucketPublicAccessBlock permission is not given. Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
29
+ }
30
+ throw err;
31
+ }
32
+ try {
33
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.PutBucketAclCommand({
34
+ Bucket: bucketName,
35
+ ACL: 'public-read',
36
+ }));
37
+ }
38
+ catch (err) {
39
+ if (err.message.includes('The bucket does not allow ACLs')) {
40
+ throw new Error(`Could not add an ACL to the bucket. This might have happened because the bucket was already successfully created before but then failed to configure correctly. We recommend to delete the bucket (${bucketName}) if it is empty and start over to fix the problem.`);
41
+ }
42
+ throw err;
43
+ }
11
44
  };
12
45
  exports.createBucket = createBucket;
@@ -1,5 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }: {
2
+ import type { LambdaArchitecture } from '../shared/validate-architecture';
3
+ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }: {
3
4
  createCloudWatchLogGroup: boolean;
4
5
  region: AwsRegion;
5
6
  zipFile: string;
@@ -10,6 +11,7 @@ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFil
10
11
  alreadyCreated: boolean;
11
12
  retentionInDays: number;
12
13
  ephemerealStorageInMb: number;
14
+ architecture: LambdaArchitecture;
13
15
  customRoleArn: string;
14
16
  }) => Promise<{
15
17
  FunctionName: string;
@@ -8,7 +8,7 @@ const defaults_1 = require("../defaults");
8
8
  const aws_clients_1 = require("../shared/aws-clients");
9
9
  const hosted_layers_1 = require("../shared/hosted-layers");
10
10
  const suggested_policy_1 = require("./iam-validation/suggested-policy");
11
- const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }) => {
11
+ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }) => {
12
12
  var _a;
13
13
  if (createCloudWatchLogGroup) {
14
14
  try {
@@ -38,15 +38,15 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
38
38
  FunctionName: functionName,
39
39
  Handler: 'index.handler',
40
40
  Role: customRoleArn !== null && customRoleArn !== void 0 ? customRoleArn : defaultRoleName,
41
- Runtime: 'nodejs18.x',
42
41
  Description: 'Renders a Remotion video.',
43
42
  MemorySize: memorySizeInMb,
44
43
  Timeout: timeoutInSeconds,
45
- Layers: hosted_layers_1.hostedLayers[region].map(({ layerArn, version }) => `${layerArn}:${version}`),
46
- Architectures: ['arm64'],
44
+ Layers: hosted_layers_1.__internal_doNotUsehostedLayers[architecture][region].map(({ layerArn, version }) => `${layerArn}:${version}`),
45
+ Architectures: [architecture],
47
46
  EphemeralStorage: {
48
47
  Size: ephemerealStorageInMb,
49
48
  },
49
+ Runtime: 'nodejs14.x',
50
50
  }));
51
51
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutFunctionEventInvokeConfigCommand({
52
52
  MaximumRetryAttempts: 0,
@@ -1,10 +1,12 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
+ import type { LambdaArchitecture } from '../shared/validate-architecture';
2
3
  export declare type DeployFunctionInput = {
3
4
  createCloudWatchLogGroup: boolean;
4
5
  cloudWatchLogRetentionPeriodInDays?: number;
5
6
  region: AwsRegion;
6
7
  timeoutInSeconds: number;
7
8
  memorySizeInMb: number;
9
+ architecture: LambdaArchitecture;
8
10
  diskSizeInMb?: number;
9
11
  customRoleArn?: string;
10
12
  };
@@ -20,6 +22,7 @@ export declare type DeployFunctionOutput = {
20
22
  * @param options.region The region you want to deploy your function to.
21
23
  * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
22
24
  * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
25
+ * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
23
26
  * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
24
27
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
25
28
  */
@@ -7,6 +7,7 @@ const constants_1 = require("../shared/constants");
7
7
  const function_zip_path_1 = require("../shared/function-zip-path");
8
8
  const get_account_id_1 = require("../shared/get-account-id");
9
9
  const lambda_version_string_1 = require("../shared/lambda-version-string");
10
+ const validate_architecture_1 = require("../shared/validate-architecture");
10
11
  const validate_aws_region_1 = require("../shared/validate-aws-region");
11
12
  const validate_custom_role_arn_1 = require("../shared/validate-custom-role-arn");
12
13
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
@@ -22,6 +23,7 @@ const create_function_1 = require("./create-function");
22
23
  * @param options.region The region you want to deploy your function to.
23
24
  * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
24
25
  * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
26
+ * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
25
27
  * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
26
28
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
27
29
  */
@@ -32,6 +34,7 @@ const deployFunction = async (options) => {
32
34
  (0, validate_timeout_1.validateTimeout)(options.timeoutInSeconds);
33
35
  (0, validate_aws_region_1.validateAwsRegion)(options.region);
34
36
  (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
37
+ (0, validate_architecture_1.validateArchitecture)(options.architecture);
35
38
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
36
39
  (0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
37
40
  const fnNameRender = [
@@ -52,13 +55,16 @@ const deployFunction = async (options) => {
52
55
  const created = await (0, create_function_1.createFunction)({
53
56
  createCloudWatchLogGroup: options.createCloudWatchLogGroup,
54
57
  region: options.region,
55
- zipFile: function_zip_path_1.FUNCTION_ZIP_ARM64,
58
+ zipFile: options.architecture === 'arm64'
59
+ ? function_zip_path_1.FUNCTION_ZIP_ARM64
60
+ : function_zip_path_1.FUNCTION_ZIP_X86_64,
56
61
  functionName: fnNameRender,
57
62
  accountId,
58
63
  memorySizeInMb: options.memorySizeInMb,
59
64
  timeoutInSeconds: options.timeoutInSeconds,
60
65
  retentionInDays: (_b = options.cloudWatchLogRetentionPeriodInDays) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
61
66
  alreadyCreated: Boolean(alreadyDeployed),
67
+ architecture: options.architecture,
62
68
  ephemerealStorageInMb: diskSizeInMb,
63
69
  customRoleArn: options.customRoleArn,
64
70
  });
@@ -87,9 +87,14 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
87
87
  })),
88
88
  ]);
89
89
  if (!process.env.VITEST) {
90
- fs_1.default.rmSync(bundled, {
91
- recursive: true,
92
- });
90
+ if (fs_1.default.rmSync) {
91
+ fs_1.default.rmSync(bundled, {
92
+ recursive: true,
93
+ });
94
+ }
95
+ else {
96
+ fs_1.default.rmdirSync(bundled, { recursive: true });
97
+ }
93
98
  }
94
99
  return {
95
100
  serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
@@ -25,3 +25,7 @@ export declare type DownloadMediaOutput = {
25
25
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
26
26
  */
27
27
  export declare const downloadMedia: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
28
+ /**
29
+ * @deprecated Renamed to downloadMedia()
30
+ */
31
+ export declare const downloadVideo: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadMedia = void 0;
6
+ exports.downloadVideo = exports.downloadMedia = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const expected_out_name_1 = require("../functions/helpers/expected-out-name");
@@ -50,3 +50,7 @@ const downloadMedia = async (input) => {
50
50
  };
51
51
  };
52
52
  exports.downloadMedia = downloadMedia;
53
+ /**
54
+ * @deprecated Renamed to downloadMedia()
55
+ */
56
+ exports.downloadVideo = exports.downloadMedia;
@@ -1,9 +1,11 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
+ import type { LambdaArchitecture } from '../shared/validate-architecture';
2
3
  export declare type EstimatePriceInput = {
3
4
  region: AwsRegion;
4
5
  durationInMiliseconds: number;
5
6
  memorySizeInMb: number;
6
7
  diskSizeInMb: number;
8
+ architecture: LambdaArchitecture;
7
9
  lambdasInvoked: number;
8
10
  };
9
11
  /**
@@ -12,4 +14,4 @@ export declare type EstimatePriceInput = {
12
14
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
13
15
  * @returns {number} Price in USD
14
16
  */
15
- export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }: EstimatePriceInput) => number;
17
+ export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }: EstimatePriceInput) => number;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.estimatePrice = void 0;
4
4
  const defaults_1 = require("../defaults");
5
5
  const price_per_1_s_1 = require("../pricing/price-per-1-s");
6
+ const validate_architecture_1 = require("../shared/validate-architecture");
6
7
  const validate_aws_region_1 = require("../shared/validate-aws-region");
7
8
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
8
9
  const validate_memory_size_1 = require("../shared/validate-memory-size");
@@ -12,9 +13,10 @@ const validate_memory_size_1 = require("../shared/validate-memory-size");
12
13
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
13
14
  * @returns {number} Price in USD
14
15
  */
15
- const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }) => {
16
+ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }) => {
16
17
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
17
18
  (0, validate_aws_region_1.validateAwsRegion)(region);
19
+ (0, validate_architecture_1.validateArchitecture)(architecture);
18
20
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
19
21
  if (typeof durationInMiliseconds !== 'number') {
20
22
  throw new TypeError(`Parameter 'durationInMiliseconds' must be a number but got ${typeof durationInMiliseconds}`);
@@ -28,11 +30,15 @@ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSize
28
30
  if (durationInMiliseconds < 0) {
29
31
  throw new TypeError(`Parameter 'durationInMiliseconds' must be over 0 but it is ${durationInMiliseconds}.`);
30
32
  }
31
- const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
33
+ const durationPrice = architecture === 'x86_64'
34
+ ? price_per_1_s_1.pricing[region]['Lambda Duration'].price
35
+ : price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
32
36
  // In GB-second
33
37
  const timeCostDollars = Number(durationPrice) *
34
38
  ((memorySizeInMb * durationInMiliseconds) / 1000 / 1024);
35
- const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
39
+ const diskSizePrice = architecture === 'x86_64'
40
+ ? price_per_1_s_1.pricing[region]['Lambda Storage-Duration'].price
41
+ : price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
36
42
  const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
37
43
  // In GB-second
38
44
  const diskSizeDollars = chargedDiskSize *
@@ -1,5 +1,5 @@
1
1
  import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
2
- import type { AnyCompMetadata } from 'remotion';
2
+ import type { TCompMetadata } from 'remotion';
3
3
  import type { AwsRegion } from '../client';
4
4
  export declare type GetCompositionsOnLambdaInput = {
5
5
  chromiumOptions?: ChromiumOptions;
@@ -13,7 +13,7 @@ export declare type GetCompositionsOnLambdaInput = {
13
13
  forceBucketName?: string;
14
14
  dumpBrowserLogs?: boolean;
15
15
  };
16
- export declare type GetCompositionsOnLambdaOutput = AnyCompMetadata[];
16
+ export declare type GetCompositionsOnLambdaOutput = TCompMetadata[];
17
17
  /**
18
18
  * @description Returns the compositions from a serveUrl
19
19
  * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
@@ -1,6 +1,7 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
2
  export declare type GetOrCreateBucketInput = {
3
3
  region: AwsRegion;
4
+ onBucketEnsured?: () => void;
4
5
  };
5
6
  export declare type GetOrCreateBucketOutput = {
6
7
  bucketName: string;
@@ -12,11 +12,13 @@ const get_buckets_1 = require("./get-buckets");
12
12
  * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
13
13
  */
14
14
  const getOrCreateBucket = async (options) => {
15
+ var _a, _b;
15
16
  const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
16
17
  if (remotionBuckets.length > 1) {
17
18
  throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${options.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
18
19
  }
19
20
  if (remotionBuckets.length === 1) {
21
+ (_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
20
22
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
21
23
  }
22
24
  const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
@@ -24,6 +26,7 @@ const getOrCreateBucket = async (options) => {
24
26
  bucketName,
25
27
  region: options.region,
26
28
  });
29
+ (_b = options.onBucketEnsured) === null || _b === void 0 ? void 0 : _b.call(options);
27
30
  return { bucketName, alreadyExisted: false };
28
31
  };
29
32
  exports.getOrCreateBucket = getOrCreateBucket;
@@ -36,12 +36,10 @@ const simulatePermissions = async (options) => {
36
36
  }
37
37
  const callerIdentityArnType = callerIdentityArnComponents[1];
38
38
  let callerArn;
39
- if (callerIdentityArnType === 'iam' &&
40
- callerIdentityArnComponents[3] === 'user') {
39
+ if (callerIdentityArnType === 'iam' && callerIdentityArnComponents[3] === 'user') {
41
40
  callerArn = callerIdentity.Arn;
42
41
  }
43
- else if (callerIdentityArnType === 'sts' &&
44
- callerIdentityArnComponents[3] === 'assumed-role') {
42
+ else if (callerIdentityArnType === 'sts' && callerIdentityArnComponents[3] === 'assumed-role') {
45
43
  const assumedRoleComponents = callerIdentityArnComponents[4].match(/\/([^/]+)\/(.*)/);
46
44
  if (!assumedRoleComponents) {
47
45
  throw new Error('Unsupported AWS Caller Identity as Assumed-Role ARN detected');
@@ -37,6 +37,8 @@ exports.requiredPermissions = [
37
37
  aws_policies_1.s3.GetBucketLocation,
38
38
  aws_policies_1.s3.PutBucketAcl,
39
39
  aws_policies_1.s3.DeleteBucket,
40
+ aws_policies_1.s3.PutBucketOwnershipControls,
41
+ aws_policies_1.s3.PutBucketPublicAccessBlock,
40
42
  ],
41
43
  resource: [`arn:aws:s3:::${constants_1.REMOTION_BUCKET_PREFIX}*`],
42
44
  },
@@ -1,4 +1,4 @@
1
- import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, VideoImageFormat } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
2
2
  import type { AwsRegion } from '../pricing/aws-regions';
3
3
  import type { OutNameInput, Privacy } from '../shared/constants';
4
4
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -10,17 +10,13 @@ export declare type RenderMediaOnLambdaInput = {
10
10
  composition: string;
11
11
  inputProps?: unknown;
12
12
  codec: LambdaCodec;
13
- imageFormat?: VideoImageFormat;
13
+ imageFormat?: ImageFormat;
14
14
  crf?: number | undefined;
15
15
  envVariables?: Record<string, string>;
16
16
  pixelFormat?: PixelFormat;
17
17
  proResProfile?: ProResProfile;
18
18
  privacy?: Privacy;
19
- /**
20
- * @deprecated Renamed to `jpegQuality`
21
- */
22
- quality?: never;
23
- jpegQuality?: number;
19
+ quality?: number;
24
20
  maxRetries?: number;
25
21
  framesPerLambda?: number;
26
22
  logLevel?: LogLevel;
@@ -66,7 +62,7 @@ export declare type RenderMediaOnLambdaOutput = {
66
62
  * @param params.crf The constant rate factor to be used during encoding.
67
63
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
68
64
  * @param params.proResProfile The ProRes profile if rendering a ProRes video
69
- * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
65
+ * @param params.quality JPEG quality if JPEG was selected as the image format.
70
66
  * @param params.region The AWS region in which the media should be rendered.
71
67
  * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
72
68
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
@@ -74,8 +70,8 @@ export declare type RenderMediaOnLambdaOutput = {
74
70
  * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch
75
71
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
76
72
  */
77
- export 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>;
73
+ export 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, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
78
74
  /**
79
75
  * @deprecated Renamed to renderMediaOnLambda()
80
76
  */
81
- export declare const renderVideoOnLambda: ({ 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>;
77
+ export declare const renderVideoOnLambda: ({ 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, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;