@remotion/lambda 4.0.147 → 4.0.149
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.
- package/dist/admin/make-layer-public.js +11 -9
- package/dist/api/create-function.d.ts +4 -1
- package/dist/api/create-function.js +35 -6
- package/dist/api/deploy-function.d.ts +3 -1
- package/dist/api/deploy-function.js +8 -3
- package/dist/api/deploy-site.d.ts +3 -3
- package/dist/api/iam-validation/role-permissions.d.ts +1 -3
- package/dist/api/iam-validation/role-permissions.js +12 -13
- package/dist/api/iam-validation/user-permissions.d.ts +1 -2
- package/dist/api/iam-validation/user-permissions.js +28 -29
- package/dist/api/make-lambda-payload.d.ts +1 -1
- package/dist/api/make-lambda-payload.js +1 -1
- package/dist/api/render-media-on-lambda.js +1 -1
- package/dist/cli/commands/functions/deploy.js +6 -2
- package/dist/cli/commands/render/progress.js +11 -19
- package/dist/cli/commands/sites/create.js +21 -12
- package/dist/cli/helpers/progress-bar.js +3 -6
- package/dist/functions/helpers/find-output-file-in-bucket.js +2 -1
- package/dist/functions/helpers/get-chromium-executable-path.js +1 -2
- package/dist/functions/helpers/io.d.ts +2 -1
- package/dist/functions/helpers/io.js +2 -2
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/launch.js +3 -0
- package/dist/functions/renderer.js +0 -1
- package/dist/internals.d.ts +5 -5
- package/dist/shared/constants.d.ts +3 -3
- package/dist/shared/hosted-layers.d.ts +1 -0
- package/dist/shared/hosted-layers.js +213 -1
- package/dist/shared/invoke-webhook.d.ts +1 -0
- package/dist/shared/invoke-webhook.js +23 -1
- package/package.json +10 -12
- package/remotionlambda-arm64.zip +0 -0
- package/dist/functions/helpers/nss.d.ts +0 -2
- package/dist/functions/helpers/nss.js +0 -39
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
4
|
-
const aws_policies_1 = require("aws-policies");
|
|
5
4
|
const version_1 = require("remotion/version");
|
|
6
5
|
const get_regions_1 = require("../api/get-regions");
|
|
7
6
|
const quit_1 = require("../cli/helpers/quit");
|
|
8
7
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
9
|
-
const runtimes = ['nodejs18.x'];
|
|
10
8
|
const layerInfo = {
|
|
11
9
|
'ap-northeast-1': [],
|
|
12
10
|
'ap-south-1': [],
|
|
@@ -30,27 +28,31 @@ const layerInfo = {
|
|
|
30
28
|
'sa-east-1': [],
|
|
31
29
|
'us-west-1': [],
|
|
32
30
|
};
|
|
31
|
+
const V5_RUNTIME = true;
|
|
33
32
|
const makeLayerPublic = async () => {
|
|
34
|
-
const
|
|
33
|
+
const runtimes = [V5_RUNTIME ? 'nodejs20.x' : 'nodejs18.x'];
|
|
34
|
+
const layers = ['fonts', 'chromium'];
|
|
35
35
|
for (const region of (0, get_regions_1.getRegions)()) {
|
|
36
36
|
for (const layer of layers) {
|
|
37
37
|
const layerName = `remotion-binaries-${layer}-arm64`;
|
|
38
38
|
const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
|
|
39
39
|
Content: {
|
|
40
40
|
S3Bucket: 'remotionlambda-binaries-' + region,
|
|
41
|
-
S3Key:
|
|
41
|
+
S3Key: V5_RUNTIME
|
|
42
|
+
? `remotion-layer-${layer}-v11-arm64.zip`
|
|
43
|
+
: `remotion-layer-${layer}-v10-arm64.zip`,
|
|
42
44
|
},
|
|
43
45
|
LayerName: layerName,
|
|
44
46
|
LicenseInfo: layer === 'chromium'
|
|
45
|
-
?
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
? V5_RUNTIME
|
|
48
|
+
? 'Chromium 123.0.6312.86, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
|
|
49
|
+
: 'Chromium 114, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
|
|
50
|
+
: 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
|
|
49
51
|
CompatibleRuntimes: runtimes,
|
|
50
52
|
Description: version_1.VERSION,
|
|
51
53
|
}));
|
|
52
54
|
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
|
|
53
|
-
Action:
|
|
55
|
+
Action: 'lambda:GetLayerVersion',
|
|
54
56
|
LayerName: layerName,
|
|
55
57
|
Principal: '*',
|
|
56
58
|
VersionNumber: Version,
|
|
@@ -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 (
|
|
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:
|
|
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 (
|
|
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
|
|
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.
|
|
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;
|
|
@@ -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: "
|
|
62
|
+
value: "verbose" | "info" | "warn" | "error";
|
|
63
63
|
source: string;
|
|
64
64
|
};
|
|
65
|
-
setConfig: (newLogLevel: "
|
|
66
|
-
type: "
|
|
65
|
+
setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
|
|
66
|
+
type: "verbose" | "info" | "warn" | "error";
|
|
67
67
|
};
|
|
68
68
|
readonly throwIfSiteExists: {
|
|
69
69
|
cliFlag: string;
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rolePermissions = void 0;
|
|
4
|
-
const aws_policies_1 = require("aws-policies");
|
|
5
4
|
const constants_1 = require("../../shared/constants");
|
|
6
5
|
exports.rolePermissions = [
|
|
7
6
|
{
|
|
8
|
-
actions: [
|
|
7
|
+
actions: ['s3:ListAllMyBuckets'],
|
|
9
8
|
resource: ['*'],
|
|
10
9
|
},
|
|
11
10
|
{
|
|
12
11
|
actions: [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
's3:CreateBucket',
|
|
13
|
+
's3:ListBucket',
|
|
14
|
+
's3:PutBucketAcl',
|
|
15
|
+
's3:GetObject',
|
|
16
|
+
's3:DeleteObject',
|
|
17
|
+
's3:PutObjectAcl',
|
|
18
|
+
's3:PutObject',
|
|
19
|
+
's3:GetBucketLocation',
|
|
21
20
|
],
|
|
22
21
|
resource: [`arn:aws:s3:::${constants_1.REMOTION_BUCKET_PREFIX}*`],
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
|
-
actions: [
|
|
24
|
+
actions: ['lambda:InvokeFunction'],
|
|
26
25
|
resource: [`arn:aws:lambda:*:*:function:${constants_1.RENDER_FN_PREFIX}*`],
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
|
-
actions: [
|
|
28
|
+
actions: ['logs:CreateLogGroup'],
|
|
30
29
|
resource: [`arn:aws:logs:*:*:log-group:${constants_1.LAMBDA_INSIGHTS_PREFIX}`],
|
|
31
30
|
},
|
|
32
31
|
{
|
|
33
|
-
actions: [
|
|
32
|
+
actions: ['logs:CreateLogStream', 'logs:PutLogEvents'],
|
|
34
33
|
resource: [
|
|
35
34
|
`arn:aws:logs:*:*:log-group:${constants_1.LOG_GROUP_PREFIX}${constants_1.RENDER_FN_PREFIX}*`,
|
|
36
35
|
`arn:aws:logs:*:*:log-group:${constants_1.LAMBDA_INSIGHTS_PREFIX}:*`,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { iam, lambda, logs, s3, servicequotas } from 'aws-policies';
|
|
2
1
|
export declare const requiredPermissions: {
|
|
3
|
-
actions:
|
|
2
|
+
actions: string[];
|
|
4
3
|
resource: string[];
|
|
5
4
|
id: string;
|
|
6
5
|
}[];
|
|
@@ -1,81 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requiredPermissions = void 0;
|
|
4
|
-
const aws_policies_1 = require("aws-policies");
|
|
5
4
|
const constants_1 = require("../../shared/constants");
|
|
6
5
|
const hosted_layers_1 = require("../../shared/hosted-layers");
|
|
7
6
|
exports.requiredPermissions = [
|
|
8
7
|
{
|
|
9
8
|
id: 'HandleQuotas',
|
|
10
9
|
actions: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
'servicequotas:GetServiceQuota',
|
|
11
|
+
'servicequotas:GetAWSDefaultServiceQuota',
|
|
12
|
+
'servicequotas:RequestServiceQuotaIncrease',
|
|
13
|
+
'servicequotas:ListRequestedServiceQuotaChangeHistoryByQuota',
|
|
15
14
|
],
|
|
16
15
|
resource: ['*'],
|
|
17
16
|
},
|
|
18
17
|
{
|
|
19
18
|
id: 'PermissionValidation',
|
|
20
|
-
actions: [
|
|
19
|
+
actions: ['iam:SimulatePrincipalPolicy'],
|
|
21
20
|
resource: ['*'],
|
|
22
21
|
},
|
|
23
22
|
{
|
|
24
23
|
id: 'LambdaInvokation',
|
|
25
|
-
actions: [
|
|
24
|
+
actions: ['iam:PassRole'],
|
|
26
25
|
resource: ['arn:aws:iam::*:role/remotion-lambda-role'],
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
28
|
id: 'Storage',
|
|
30
29
|
actions: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
's3:GetObject',
|
|
31
|
+
's3:DeleteObject',
|
|
32
|
+
's3:PutObjectAcl',
|
|
33
|
+
's3:PutObject',
|
|
34
|
+
's3:CreateBucket',
|
|
35
|
+
's3:ListBucket',
|
|
36
|
+
's3:GetBucketLocation',
|
|
37
|
+
's3:PutBucketAcl',
|
|
38
|
+
's3:DeleteBucket',
|
|
39
|
+
's3:PutBucketOwnershipControls',
|
|
40
|
+
's3:PutBucketPublicAccessBlock',
|
|
41
|
+
's3:PutLifecycleConfiguration',
|
|
43
42
|
],
|
|
44
43
|
resource: [`arn:aws:s3:::${constants_1.REMOTION_BUCKET_PREFIX}*`],
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
id: 'BucketListing',
|
|
48
|
-
actions: [
|
|
47
|
+
actions: ['s3:ListAllMyBuckets'],
|
|
49
48
|
resource: ['*'],
|
|
50
49
|
},
|
|
51
50
|
{
|
|
52
51
|
id: 'FunctionListing',
|
|
53
|
-
actions: [
|
|
52
|
+
actions: ['lambda:ListFunctions', 'lambda:GetFunction'],
|
|
54
53
|
resource: ['*'],
|
|
55
54
|
},
|
|
56
55
|
{
|
|
57
56
|
id: 'FunctionManagement',
|
|
58
57
|
actions: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
'lambda:InvokeAsync',
|
|
59
|
+
'lambda:InvokeFunction',
|
|
60
|
+
'lambda:CreateFunction',
|
|
61
|
+
'lambda:DeleteFunction',
|
|
62
|
+
'lambda:PutFunctionEventInvokeConfig',
|
|
64
63
|
'lambda:PutRuntimeManagementConfig',
|
|
65
|
-
|
|
64
|
+
'lambda:TagResource',
|
|
66
65
|
],
|
|
67
66
|
resource: [`arn:aws:lambda:*:*:function:${constants_1.RENDER_FN_PREFIX}*`],
|
|
68
67
|
},
|
|
69
68
|
{
|
|
70
69
|
id: 'LogsRetention',
|
|
71
|
-
actions: [
|
|
70
|
+
actions: ['logs:CreateLogGroup', 'logs:PutRetentionPolicy'],
|
|
72
71
|
resource: [
|
|
73
72
|
`arn:aws:logs:*:*:log-group:${constants_1.LOG_GROUP_PREFIX}${constants_1.RENDER_FN_PREFIX}*`,
|
|
74
73
|
],
|
|
75
74
|
},
|
|
76
75
|
{
|
|
77
76
|
id: 'FetchBinaries',
|
|
78
|
-
actions: [
|
|
77
|
+
actions: ['lambda:GetLayerVersion'],
|
|
79
78
|
resource: [
|
|
80
79
|
hosted_layers_1.REMOTION_HOSTED_LAYER_ARN,
|
|
81
80
|
'arn:aws:lambda:*:580247275435:layer:LambdaInsightsExtension*',
|
|
@@ -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 :
|
|
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 :
|
|
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.
|
|
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);
|
|
@@ -5,20 +5,19 @@ const cli_1 = require("@remotion/cli");
|
|
|
5
5
|
const renderer_1 = require("@remotion/renderer");
|
|
6
6
|
const no_react_1 = require("remotion/no-react");
|
|
7
7
|
const truthy_1 = require("../../../shared/truthy");
|
|
8
|
-
const makeInvokeProgress = (invokeProgress,
|
|
8
|
+
const makeInvokeProgress = (invokeProgress, retriesInfo) => {
|
|
9
9
|
const { lambdasInvoked, totalLambdas } = invokeProgress;
|
|
10
10
|
const progress = totalLambdas === null ? 0 : lambdasInvoked / totalLambdas;
|
|
11
11
|
return [
|
|
12
|
-
|
|
12
|
+
`${progress === 0 ? 'Invoked' : 'Invoking'} lambdas`.padEnd(cli_1.CliInternals.LABEL_WIDTH),
|
|
13
13
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
14
|
-
`${progress === 0 ? 'Invoked' : 'Invoking'} lambdas`,
|
|
15
14
|
progress === 1
|
|
16
15
|
? cli_1.CliInternals.chalk.gray('100%')
|
|
17
16
|
: `${Math.round(progress * 100)}%`,
|
|
18
17
|
retriesInfo.length > 0 ? `(+${retriesInfo.length} retries)` : [],
|
|
19
18
|
].join(' ');
|
|
20
19
|
};
|
|
21
|
-
const makeRenderProgress = ({ chunkProgress,
|
|
20
|
+
const makeRenderProgress = ({ chunkProgress, }) => {
|
|
22
21
|
const { chunksEncoded, totalChunks, doneIn } = chunkProgress;
|
|
23
22
|
const renderProgress = chunkProgress.totalFrames === null
|
|
24
23
|
? 0
|
|
@@ -26,26 +25,24 @@ const makeRenderProgress = ({ chunkProgress, totalSteps, }) => {
|
|
|
26
25
|
const encodingProgress = totalChunks === null ? 0 : chunksEncoded / totalChunks;
|
|
27
26
|
const frames = chunkProgress.totalFrames === null
|
|
28
27
|
? null
|
|
29
|
-
:
|
|
28
|
+
: `${chunkProgress.framesRendered}/${chunkProgress.totalFrames}`;
|
|
30
29
|
const first = [
|
|
31
|
-
|
|
30
|
+
(doneIn === null ? 'Rendering frames' : 'Rendered frames').padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
32
31
|
cli_1.CliInternals.makeProgressBar(renderProgress),
|
|
33
|
-
doneIn === null ? 'Rendering frames' : 'Rendered frames',
|
|
34
32
|
doneIn === null ? frames : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
35
33
|
]
|
|
36
34
|
.filter(truthy_1.truthy)
|
|
37
35
|
.join(' ');
|
|
38
36
|
const second = [
|
|
39
|
-
|
|
37
|
+
`${doneIn === null ? 'Encoding' : 'Encoded'} chunks`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
40
38
|
cli_1.CliInternals.makeProgressBar(encodingProgress),
|
|
41
|
-
`${doneIn === null ? 'Encoding' : 'Encoded'} chunks`,
|
|
42
39
|
doneIn === null
|
|
43
40
|
? `${Math.round(encodingProgress * 100)}%`
|
|
44
41
|
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
45
42
|
].join(' ');
|
|
46
43
|
return [first, second];
|
|
47
44
|
};
|
|
48
|
-
const makeEncodingProgress = ({ encodingProgress, chunkProgress,
|
|
45
|
+
const makeEncodingProgress = ({ encodingProgress, chunkProgress, totalFrames, timeToEncode, }) => {
|
|
49
46
|
const { framesEncoded } = encodingProgress;
|
|
50
47
|
const progress = totalFrames === null ? 0 : framesEncoded / totalFrames;
|
|
51
48
|
const chunksDone = chunkProgress.doneIn !== null;
|
|
@@ -54,28 +51,25 @@ const makeEncodingProgress = ({ encodingProgress, chunkProgress, totalSteps, tot
|
|
|
54
51
|
return '';
|
|
55
52
|
}
|
|
56
53
|
return [
|
|
57
|
-
|
|
54
|
+
`${timeToEncode === null ? 'Combining' : 'Combined'} videos`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
58
55
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
59
|
-
`${timeToEncode === null ? 'Combining' : 'Combined'} videos`,
|
|
60
56
|
timeToEncode === null
|
|
61
57
|
? `${Math.round(progress * 100)}%`
|
|
62
58
|
: cli_1.CliInternals.chalk.gray(`${timeToEncode}ms`),
|
|
63
59
|
].join(' ');
|
|
64
60
|
};
|
|
65
|
-
const makeCleanupProgress = (cleanupInfo,
|
|
61
|
+
const makeCleanupProgress = (cleanupInfo, skipped) => {
|
|
66
62
|
if (!cleanupInfo) {
|
|
67
63
|
return '';
|
|
68
64
|
}
|
|
69
65
|
if (skipped) {
|
|
70
66
|
return [
|
|
71
|
-
`(5/${totalSteps})`,
|
|
72
67
|
cli_1.CliInternals.chalk.blueBright(`Not cleaning up because --log=verbose was set`),
|
|
73
68
|
].join(' ');
|
|
74
69
|
}
|
|
75
70
|
const { doneIn, filesDeleted, minFilesToDelete } = cleanupInfo;
|
|
76
71
|
const progress = filesDeleted / minFilesToDelete;
|
|
77
72
|
return [
|
|
78
|
-
`(5/${totalSteps})`,
|
|
79
73
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
80
74
|
`${doneIn === null ? 'Cleaning up' : 'Cleaned up'} artifacts`,
|
|
81
75
|
doneIn === null
|
|
@@ -127,19 +121,17 @@ const makeMultiProgressFromStatus = (status) => {
|
|
|
127
121
|
exports.makeMultiProgressFromStatus = makeMultiProgressFromStatus;
|
|
128
122
|
const makeProgressString = ({ progress, steps, downloadInfo, retriesInfo, logLevel, timeToEncode, totalFrames, }) => {
|
|
129
123
|
return [
|
|
130
|
-
makeInvokeProgress(progress.lambdaInvokeProgress,
|
|
124
|
+
makeInvokeProgress(progress.lambdaInvokeProgress, retriesInfo),
|
|
131
125
|
...makeRenderProgress({
|
|
132
126
|
chunkProgress: progress.chunkProgress,
|
|
133
|
-
totalSteps: steps,
|
|
134
127
|
}),
|
|
135
128
|
makeEncodingProgress({
|
|
136
129
|
encodingProgress: progress.encodingProgress,
|
|
137
130
|
chunkProgress: progress.chunkProgress,
|
|
138
|
-
totalSteps: steps,
|
|
139
131
|
timeToEncode,
|
|
140
132
|
totalFrames,
|
|
141
133
|
}),
|
|
142
|
-
makeCleanupProgress(progress.cleanupInfo,
|
|
134
|
+
makeCleanupProgress(progress.cleanupInfo, logLevel === 'verbose'),
|
|
143
135
|
downloadInfo ? makeDownloadProgress(downloadInfo, steps) : null,
|
|
144
136
|
]
|
|
145
137
|
.filter(no_react_1.NoReactInternals.truthy)
|