@remotion/lambda 4.0.0-preload.17 → 4.0.0-spawn.10

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.
@@ -1,6 +1,6 @@
1
1
  import { AwsRegion } from '../pricing/aws-regions';
2
2
  import { LambdaArchitecture } from '../shared/validate-architecture';
3
- export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, }: {
3
+ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }: {
4
4
  createCloudWatchLogGroup: boolean;
5
5
  region: AwsRegion;
6
6
  zipFile: string;
@@ -12,6 +12,7 @@ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFil
12
12
  retentionInDays: number;
13
13
  ephemerealStorageInMb: number;
14
14
  architecture: LambdaArchitecture;
15
+ customRoleArn: string;
15
16
  }) => Promise<{
16
17
  FunctionName: string;
17
18
  }>;
@@ -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, architecture, ephemerealStorageInMb, }) => {
11
+ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }) => {
12
12
  if (createCloudWatchLogGroup) {
13
13
  try {
14
14
  await (0, aws_clients_1.getCloudWatchLogsClient)(region).send(new client_cloudwatch_logs_1.CreateLogGroupCommand({
@@ -29,13 +29,14 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
29
29
  if (alreadyCreated) {
30
30
  return { FunctionName: functionName };
31
31
  }
32
+ const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
32
33
  const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
33
34
  Code: {
34
35
  ZipFile: (0, fs_1.readFileSync)(zipFile),
35
36
  },
36
37
  FunctionName: functionName,
37
38
  Handler: 'index.handler',
38
- Role: `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`,
39
+ Role: customRoleArn !== null && customRoleArn !== void 0 ? customRoleArn : defaultRoleName,
39
40
  Runtime: 'nodejs14.x',
40
41
  Description: 'Renders a Remotion video.',
41
42
  MemorySize: memorySizeInMb,
@@ -8,6 +8,7 @@ export declare type DeployFunctionInput = {
8
8
  memorySizeInMb: number;
9
9
  architecture: LambdaArchitecture;
10
10
  diskSizeInMb?: number;
11
+ customRoleArn?: string;
11
12
  };
12
13
  export declare type DeployFunctionOutput = {
13
14
  functionName: string;
@@ -7,6 +7,7 @@ const function_zip_path_1 = require("../shared/function-zip-path");
7
7
  const get_account_id_1 = require("../shared/get-account-id");
8
8
  const validate_architecture_1 = require("../shared/validate-architecture");
9
9
  const validate_aws_region_1 = require("../shared/validate-aws-region");
10
+ const validate_custom_role_arn_1 = require("../shared/validate-custom-role-arn");
10
11
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
11
12
  const validate_memory_size_1 = require("../shared/validate-memory-size");
12
13
  const validate_retention_period_1 = require("../shared/validate-retention-period");
@@ -33,6 +34,7 @@ const deployFunction = async (options) => {
33
34
  (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
34
35
  (0, validate_architecture_1.validateArchitecture)(options.architecture);
35
36
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
37
+ (0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
36
38
  const fnNameRender = [
37
39
  `${constants_1.RENDER_FN_PREFIX}${constants_1.CURRENT_VERSION}`,
38
40
  `mem${options.memorySizeInMb}mb`,
@@ -60,6 +62,7 @@ const deployFunction = async (options) => {
60
62
  alreadyCreated: Boolean(alreadyDeployed),
61
63
  architecture: options.architecture,
62
64
  ephemerealStorageInMb: diskSizeInMb,
65
+ customRoleArn: options.customRoleArn,
63
66
  });
64
67
  if (!created.FunctionName) {
65
68
  throw new Error('Lambda was created but has no name');
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -21,6 +21,7 @@ declare type LambdaCommandLineOptions = {
21
21
  ['frames-per-lambda']: number;
22
22
  ['out-name']: string | undefined;
23
23
  ['architecture']: LambdaArchitecture;
24
+ ['custom-role-arn']: string | undefined;
24
25
  privacy: Privacy;
25
26
  };
26
27
  export declare const parsedLambdaCli: LambdaCommandLineOptions & minimist.ParsedArgs;
@@ -6,6 +6,7 @@ const log_1 = require("@remotion/cli/dist/log");
6
6
  const deploy_function_1 = require("../../../api/deploy-function");
7
7
  const constants_1 = require("../../../shared/constants");
8
8
  const validate_architecture_1 = require("../../../shared/validate-architecture");
9
+ const validate_custom_role_arn_1 = require("../../../shared/validate-custom-role-arn");
9
10
  const validate_disk_size_in_mb_1 = require("../../../shared/validate-disk-size-in-mb");
10
11
  const validate_memory_size_1 = require("../../../shared/validate-memory-size");
11
12
  const validate_timeout_1 = require("../../../shared/validate-timeout");
@@ -13,18 +14,20 @@ const args_1 = require("../../args");
13
14
  const get_aws_region_1 = require("../../get-aws-region");
14
15
  exports.FUNCTIONS_DEPLOY_SUBCOMMAND = 'deploy';
15
16
  const functionsDeploySubcommand = async () => {
16
- var _a, _b, _c, _d, _e;
17
+ var _a, _b, _c, _d, _e, _f;
17
18
  const region = (0, get_aws_region_1.getAwsRegion)();
18
19
  const timeoutInSeconds = (_a = args_1.parsedLambdaCli.timeout) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_TIMEOUT;
19
20
  const memorySizeInMb = (_b = args_1.parsedLambdaCli.memory) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MEMORY_SIZE;
20
21
  const diskSizeInMb = (_c = args_1.parsedLambdaCli.disk) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
21
22
  const architecture = (_d = args_1.parsedLambdaCli.architecture) !== null && _d !== void 0 ? _d : constants_1.DEFAULT_ARCHITECTURE;
23
+ const customRoleArn = (_e = args_1.parsedLambdaCli['custom-role-arn']) !== null && _e !== void 0 ? _e : undefined;
22
24
  const createCloudWatchLogGroup = !args_1.parsedLambdaCli['disable-cloudwatch'];
23
- const cloudWatchLogRetentionPeriodInDays = (_e = args_1.parsedLambdaCli['retention-period']) !== null && _e !== void 0 ? _e : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD;
25
+ const cloudWatchLogRetentionPeriodInDays = (_f = args_1.parsedLambdaCli['retention-period']) !== null && _f !== void 0 ? _f : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD;
24
26
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
25
27
  (0, validate_timeout_1.validateTimeout)(timeoutInSeconds);
26
28
  (0, validate_architecture_1.validateArchitecture)(architecture);
27
29
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
30
+ (0, validate_custom_role_arn_1.validateCustomRoleArn)(customRoleArn);
28
31
  if (!cli_1.CliInternals.quietFlagProvided()) {
29
32
  log_1.Log.info(cli_1.CliInternals.chalk.gray(`
30
33
  Region = ${region}
@@ -47,6 +50,7 @@ CloudWatch Retention Period = ${cloudWatchLogRetentionPeriodInDays} days
47
50
  cloudWatchLogRetentionPeriodInDays,
48
51
  architecture,
49
52
  diskSizeInMb,
53
+ customRoleArn,
50
54
  });
51
55
  if (cli_1.CliInternals.quietFlagProvided()) {
52
56
  log_1.Log.info(functionName);
package/dist/cli/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cli = exports.executeCommand = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const suggested_policy_1 = require("../api/iam-validation/suggested-policy");
6
+ const defaults_1 = require("../defaults");
6
7
  const check_credentials_1 = require("../shared/check-credentials");
7
8
  const docs_url_1 = require("../shared/docs-url");
8
9
  const args_1 = require("./args");
@@ -99,6 +100,15 @@ const executeCommand = async (args) => {
99
100
  catch (err) {
100
101
  const error = err;
101
102
  if (error.message.includes('The role defined for the function cannot be assumed by Lambda')) {
103
+ if (args_1.parsedLambdaCli['custom-role-arn']) {
104
+ log_1.Log.error(`
105
+ The role "${args_1.parsedLambdaCli['custom-role-arn']}" does not exist or has the wrong policy assigned to it. Do either:
106
+ - Remove the "--custom-role-arn" parameter and set up Remotion Lambda according to the setup guide
107
+ - Make sure the role has the same policy assigned as the one returned by "npx ${defaults_1.BINARY_NAME} ${policies_1.POLICIES_COMMAND} ${role_1.ROLE_SUBCOMMAND}"
108
+
109
+ Revisit ${docs_url_1.DOCS_URL}/docs/lambda/setup and make sure you set up the role and role policy correctly. Also see the troubleshooting page: ${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/permissions. The original error message is:
110
+ `.trim());
111
+ }
102
112
  log_1.Log.error(`
103
113
  The role "${suggested_policy_1.ROLE_NAME}" does not exist in your AWS account or has the wrong policy assigned to it. Common reasons:
104
114
  - The name of the role is not "${suggested_policy_1.ROLE_NAME}"
package/dist/defaults.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFilesToDelete = void 0;
4
4
  const constants_1 = require("../../shared/constants");
5
5
  const getFilesToDelete = ({ chunkCount, renderId, }) => {
6
- const chunks = new Array(chunkCount).fill(true).map((x, i) => (0, constants_1.chunkKeyForIndex)({
6
+ const chunks = new Array(chunkCount).fill(true).map((_x, i) => (0, constants_1.chunkKeyForIndex)({
7
7
  index: i,
8
8
  renderId,
9
9
  }));
10
10
  const lambdaTimings = new Array(chunkCount)
11
11
  .fill(true)
12
- .map((x, i) => (0, constants_1.lambdaTimingsPrefixForChunk)(renderId, i));
12
+ .map((_x, i) => (0, constants_1.lambdaTimingsPrefixForChunk)(renderId, i));
13
13
  return [
14
14
  {
15
15
  name: (0, constants_1.lambdaInitializedPrefix)(renderId),
@@ -210,7 +210,7 @@ export declare type RenderMetadata = {
210
210
  renderId: string;
211
211
  outName: OutNameInput | undefined;
212
212
  };
213
- export declare type LambdaVersions = '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
213
+ export declare type LambdaVersions = '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
214
214
  export declare const CURRENT_VERSION: LambdaVersions;
215
215
  export declare type PostRenderData = {
216
216
  cost: {
@@ -84,6 +84,6 @@ var LambdaRoutines;
84
84
  LambdaRoutines["renderer"] = "renderer";
85
85
  LambdaRoutines["still"] = "still";
86
86
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
87
- exports.CURRENT_VERSION = '2022-05-27';
87
+ exports.CURRENT_VERSION = '2022-05-31';
88
88
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
89
89
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -1,3 +1,3 @@
1
- export declare const randomHash: (options?: {
1
+ export declare const randomHash: (_options?: {
2
2
  randomInTests: boolean;
3
- } | undefined) => string;
3
+ }) => string;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.randomHash = void 0;
4
4
  const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';
5
5
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
- const randomHash = (options) => {
6
+ const randomHash = (_options) => {
7
7
  return new Array(10)
8
8
  .fill(1)
9
9
  .map(() => {
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { Readable } from 'stream';
3
4
  export declare function streamToString(stream: Readable | Buffer): string | Promise<string>;
@@ -0,0 +1 @@
1
+ export declare const validateCustomRoleArn: (customRoleArn: unknown) => void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateCustomRoleArn = void 0;
4
+ const validateCustomRoleArn = (customRoleArn) => {
5
+ if (typeof customRoleArn !== 'undefined' &&
6
+ typeof customRoleArn !== 'string') {
7
+ throw new TypeError('A custom role ARN must either be "undefined" or a string, but instead got: ' +
8
+ JSON.stringify(customRoleArn));
9
+ }
10
+ };
11
+ exports.validateCustomRoleArn = validateCustomRoleArn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.0-preload.17+14cd6033f",
3
+ "version": "4.0.0-spawn.10+911177607",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -31,14 +31,14 @@
31
31
  "@aws-sdk/client-service-quotas": "3.58.0",
32
32
  "@aws-sdk/lib-storage": "3.58.0",
33
33
  "@aws-sdk/s3-request-presigner": "3.58.0",
34
- "@remotion/bundler": "4.0.0-preload.17+14cd6033f",
35
- "@remotion/cli": "4.0.0-preload.17+14cd6033f",
36
- "@remotion/renderer": "4.0.0-preload.17+14cd6033f",
34
+ "@remotion/bundler": "4.0.0-spawn.10+911177607",
35
+ "@remotion/cli": "4.0.0-spawn.10+911177607",
36
+ "@remotion/renderer": "4.0.0-spawn.10+911177607",
37
37
  "aws-policies": "^1.0.1",
38
38
  "dotenv": "^10.0.0",
39
39
  "mime-types": "2.1.34",
40
40
  "minimist": "1.2.6",
41
- "remotion": "4.0.0-preload.17+14cd6033f"
41
+ "remotion": "4.0.0-spawn.10+911177607"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": ">=16.8.0",
@@ -57,12 +57,12 @@
57
57
  "prettier": "^2.4.1",
58
58
  "prettier-plugin-organize-imports": "^2.3.4",
59
59
  "ts-jest": "^27.0.5",
60
- "ts-node": "^9.1.1",
61
- "typescript": "^4.5.5",
60
+ "ts-node": "^10.8.0",
61
+ "typescript": "^4.7.0",
62
62
  "zip-lib": "^0.7.2"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "14cd6033f4ad0fa75af142d54a4cd1a23aff3f21"
67
+ "gitHead": "911177607ac127d9f4d1c014ad8ae32fd14947dd"
68
68
  }
Binary file