@remotion/lambda 4.0.0-alpha4 → 4.0.0-alpha6
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/bundle-lambda.js +24 -30
- package/dist/admin/generate-etag-list.js +4 -4
- package/dist/admin/make-layer-public.js +59 -87
- package/dist/api/clean-items.js +1 -1
- package/dist/api/create-function.d.ts +1 -3
- package/dist/api/create-function.js +8 -8
- package/dist/api/deploy-function.d.ts +0 -3
- package/dist/api/deploy-function.js +1 -7
- package/dist/api/deploy-site.js +4 -9
- package/dist/api/download-media.d.ts +0 -4
- package/dist/api/download-media.js +3 -7
- package/dist/api/estimate-price.d.ts +1 -3
- package/dist/api/estimate-price.js +3 -9
- package/dist/api/get-compositions-on-lambda.d.ts +2 -2
- package/dist/api/get-or-create-bucket.d.ts +0 -1
- package/dist/api/get-or-create-bucket.js +0 -3
- package/dist/api/get-sites.d.ts +0 -1
- package/dist/api/iam-validation/simulate.js +4 -2
- package/dist/api/make-lambda-payload.d.ts +41 -0
- package/dist/api/make-lambda-payload.js +65 -0
- package/dist/api/render-media-on-lambda.d.ts +10 -6
- package/dist/api/render-media-on-lambda.js +5 -58
- package/dist/api/render-still-on-lambda.d.ts +7 -3
- package/dist/api/render-still-on-lambda.js +6 -3
- package/dist/api/upload-dir.js +7 -7
- package/dist/cli/args.d.ts +0 -2
- package/dist/cli/commands/functions/deploy.js +7 -9
- package/dist/cli/commands/functions/ls.js +4 -1
- package/dist/cli/commands/functions/rm.js +8 -2
- package/dist/cli/commands/functions/rmall.js +8 -2
- package/dist/cli/commands/quotas/increase.js +2 -2
- package/dist/cli/commands/render/render.js +22 -12
- package/dist/cli/commands/sites/create.js +7 -8
- package/dist/cli/commands/still.js +7 -5
- package/dist/cli/help.js +4 -0
- package/dist/cli/helpers/progress-bar.d.ts +1 -2
- package/dist/cli/helpers/progress-bar.js +3 -7
- package/dist/cli/index.js +3 -3
- package/dist/cli/log.d.ts +12 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/compositions.d.ts +1 -1
- package/dist/functions/compositions.js +0 -2
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +1 -3
- package/dist/functions/helpers/calculate-price-from-bucket.js +1 -2
- package/dist/functions/helpers/clean-tmpdir.js +7 -7
- package/dist/functions/helpers/concat-videos.d.ts +2 -4
- package/dist/functions/helpers/concat-videos.js +8 -11
- package/dist/functions/helpers/create-post-render-data.js +0 -2
- package/dist/functions/helpers/get-chromium-executable-path.js +6 -1
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-files-in-folder.js +5 -5
- package/dist/functions/helpers/get-progress.js +0 -2
- package/dist/functions/helpers/io.d.ts +1 -1
- package/dist/functions/helpers/is-enosp-err.js +1 -1
- package/dist/functions/helpers/validate-composition.d.ts +3 -5
- package/dist/functions/helpers/validate-composition.js +1 -3
- package/dist/functions/index.d.ts +15 -4
- package/dist/functions/index.js +1 -1
- package/dist/functions/launch.js +10 -14
- package/dist/functions/renderer.js +15 -15
- package/dist/functions/start.js +1 -1
- package/dist/functions/still.js +7 -11
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1 -2
- package/dist/internals.d.ts +40 -0
- package/dist/internals.js +2 -0
- package/dist/shared/aws-clients.js +2 -2
- package/dist/shared/call-lambda.js +11 -0
- package/dist/shared/constants.d.ts +20 -17
- package/dist/shared/constants.js +1 -2
- package/dist/shared/function-zip-path.d.ts +0 -1
- package/dist/shared/function-zip-path.js +3 -4
- package/dist/shared/get-etag.js +4 -4
- package/dist/shared/hosted-layers.d.ts +2 -91
- package/dist/shared/hosted-layers.js +64 -363
- package/dist/shared/invoke-webhook.d.ts +1 -3
- package/dist/shared/invoke-webhook.js +4 -4
- package/dist/shared/make-s3-key.js +2 -2
- package/dist/shared/make-s3-url.js +2 -2
- package/dist/shared/read-dir.js +2 -2
- package/dist/shared/serialize-input-props.js +1 -1
- package/dist/shared/validate-privacy.js +1 -1
- package/package.json +9 -10
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
- package/remotionlambda.zip +0 -0
|
@@ -4,51 +4,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const bundler_1 = require("@remotion/bundler");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const compositor_linux_arm64_gnu_1 = require("@remotion/compositor-linux-arm64-gnu");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
10
|
const quit_1 = require("../cli/helpers/quit");
|
|
12
11
|
const function_zip_path_1 = require("../shared/function-zip-path");
|
|
13
12
|
const zl = require("zip-lib");
|
|
14
|
-
const bundleLambda = async (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fs_1.default.mkdirSync(outdir, {
|
|
13
|
+
const bundleLambda = async () => {
|
|
14
|
+
const outdir = node_path_1.default.join(__dirname, '..', `build-render`);
|
|
15
|
+
node_fs_1.default.mkdirSync(outdir, {
|
|
18
16
|
recursive: true,
|
|
19
17
|
});
|
|
20
|
-
const outfile =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const template = require.resolve(
|
|
18
|
+
const outfile = node_path_1.default.join(outdir, 'index.js');
|
|
19
|
+
node_fs_1.default.rmSync(outdir, { recursive: true });
|
|
20
|
+
node_fs_1.default.mkdirSync(outdir, { recursive: true });
|
|
21
|
+
const template = require.resolve(node_path_1.default.join(__dirname, '..', 'functions', 'index'));
|
|
24
22
|
await bundler_1.BundlerInternals.esbuild.build({
|
|
25
23
|
platform: 'node',
|
|
26
|
-
target: '
|
|
24
|
+
target: 'node16',
|
|
27
25
|
bundle: true,
|
|
28
26
|
outfile,
|
|
29
27
|
entryPoints: [template],
|
|
30
28
|
treeShaking: true,
|
|
31
|
-
external: [
|
|
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
|
+
],
|
|
32
37
|
});
|
|
33
38
|
const compositorFile = `${outdir}/compositor`;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
}
|
|
42
|
-
fs_1.default.unlinkSync(compositorFile);
|
|
43
|
-
fs_1.default.unlinkSync(outfile);
|
|
39
|
+
node_fs_1.default.copyFileSync(compositor_linux_arm64_gnu_1.binaryPath, compositorFile);
|
|
40
|
+
await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
|
|
41
|
+
node_fs_1.default.rmSync(outdir, { recursive: true });
|
|
44
42
|
};
|
|
45
|
-
bundleLambda(
|
|
43
|
+
bundleLambda()
|
|
46
44
|
.then(() => {
|
|
47
|
-
console.log('Lambda
|
|
48
|
-
return bundleLambda('x86_64');
|
|
49
|
-
})
|
|
50
|
-
.then(() => {
|
|
51
|
-
console.log('Lambda bundled for x86_64');
|
|
45
|
+
console.log('Bundled Lambda');
|
|
52
46
|
})
|
|
53
47
|
.catch((err) => {
|
|
54
48
|
console.log(err);
|
|
@@ -3,12 +3,12 @@ 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
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const md5 = (data) =>
|
|
6
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
9
9
|
const chunks = [];
|
|
10
10
|
for (let i = 0; i < 2000; i++) {
|
|
11
11
|
const etag = `"${md5(String(i))}"`;
|
|
12
12
|
chunks.push(etag);
|
|
13
13
|
}
|
|
14
|
-
(0,
|
|
14
|
+
(0, node_fs_1.writeFileSync)('etags.json', JSON.stringify(chunks));
|
|
@@ -6,98 +6,70 @@ 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 = ['
|
|
10
|
-
const archictures = ['arm64', 'x86_64'];
|
|
9
|
+
const runtimes = ['nodejs18.x'];
|
|
11
10
|
const layerInfo = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
},
|
|
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': [],
|
|
58
32
|
};
|
|
59
33
|
const makeLayerPublic = async () => {
|
|
60
34
|
const layers = ['fonts', 'ffmpeg', 'chromium'];
|
|
61
|
-
for (const
|
|
62
|
-
for (const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 });
|
|
35
|
+
for (const region of (0, get_regions_1.getRegions)()) {
|
|
36
|
+
for (const layer of layers) {
|
|
37
|
+
const layerName = `remotion-binaries-${layer}-arm64`;
|
|
38
|
+
const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
|
|
39
|
+
Content: {
|
|
40
|
+
S3Bucket: 'remotionlambda-binaries-' + region,
|
|
41
|
+
S3Key: `remotion-layer-${layer}-v10-arm64.zip`,
|
|
42
|
+
},
|
|
43
|
+
LayerName: layerName,
|
|
44
|
+
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',
|
|
49
|
+
CompatibleRuntimes: runtimes,
|
|
50
|
+
Description: version_1.VERSION,
|
|
51
|
+
}));
|
|
52
|
+
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
|
|
53
|
+
Action: aws_policies_1.lambda.GetLayerVersion,
|
|
54
|
+
LayerName: layerName,
|
|
55
|
+
Principal: '*',
|
|
56
|
+
VersionNumber: Version,
|
|
57
|
+
StatementId: 'public-layer',
|
|
58
|
+
}));
|
|
59
|
+
if (!layerInfo[region]) {
|
|
60
|
+
layerInfo[region] = [];
|
|
100
61
|
}
|
|
62
|
+
if (!LayerArn) {
|
|
63
|
+
throw new Error('layerArn is null');
|
|
64
|
+
}
|
|
65
|
+
if (!Version) {
|
|
66
|
+
throw new Error('Version is null');
|
|
67
|
+
}
|
|
68
|
+
layerInfo[region].push({
|
|
69
|
+
layerArn: LayerArn,
|
|
70
|
+
version: Version,
|
|
71
|
+
});
|
|
72
|
+
console.log({ LayerArn, Version });
|
|
101
73
|
}
|
|
102
74
|
}
|
|
103
75
|
};
|
package/dist/api/clean-items.js
CHANGED
|
@@ -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 =
|
|
8
|
+
const cleanItems = ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, }) => {
|
|
9
9
|
return Promise.all(list.map((object) => limit(async () => {
|
|
10
10
|
onBeforeItemDeleted({
|
|
11
11
|
bucketName: bucket,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
|
-
|
|
3
|
-
export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }: {
|
|
2
|
+
export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }: {
|
|
4
3
|
createCloudWatchLogGroup: boolean;
|
|
5
4
|
region: AwsRegion;
|
|
6
5
|
zipFile: string;
|
|
@@ -11,7 +10,6 @@ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFil
|
|
|
11
10
|
alreadyCreated: boolean;
|
|
12
11
|
retentionInDays: number;
|
|
13
12
|
ephemerealStorageInMb: number;
|
|
14
|
-
architecture: LambdaArchitecture;
|
|
15
13
|
customRoleArn: string;
|
|
16
14
|
}) => Promise<{
|
|
17
15
|
FunctionName: string;
|
|
@@ -3,12 +3,12 @@ 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
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
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,
|
|
11
|
+
const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }) => {
|
|
12
12
|
var _a;
|
|
13
13
|
if (createCloudWatchLogGroup) {
|
|
14
14
|
try {
|
|
@@ -33,20 +33,20 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
33
33
|
const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
|
|
34
34
|
const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
35
|
Code: {
|
|
36
|
-
ZipFile: (0,
|
|
36
|
+
ZipFile: (0, node_fs_1.readFileSync)(zipFile),
|
|
37
37
|
},
|
|
38
38
|
FunctionName: functionName,
|
|
39
39
|
Handler: 'index.handler',
|
|
40
40
|
Role: customRoleArn !== null && customRoleArn !== void 0 ? customRoleArn : defaultRoleName,
|
|
41
|
+
Runtime: 'nodejs18.x',
|
|
41
42
|
Description: 'Renders a Remotion video.',
|
|
42
43
|
MemorySize: memorySizeInMb,
|
|
43
44
|
Timeout: timeoutInSeconds,
|
|
44
|
-
Layers: hosted_layers_1.
|
|
45
|
-
Architectures: [
|
|
45
|
+
Layers: hosted_layers_1.hostedLayers[region].map(({ layerArn, version }) => `${layerArn}:${version}`),
|
|
46
|
+
Architectures: ['arm64'],
|
|
46
47
|
EphemeralStorage: {
|
|
47
48
|
Size: ephemerealStorageInMb,
|
|
48
49
|
},
|
|
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,
|
|
@@ -66,11 +66,11 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
66
66
|
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutRuntimeManagementConfigCommand({
|
|
67
67
|
FunctionName,
|
|
68
68
|
UpdateRuntimeOn: 'Manual',
|
|
69
|
-
RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:
|
|
69
|
+
RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`,
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
72
|
catch (err) {
|
|
73
|
-
console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking
|
|
73
|
+
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.');
|
|
74
74
|
}
|
|
75
75
|
return { FunctionName: FunctionName };
|
|
76
76
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
|
-
import type { LambdaArchitecture } from '../shared/validate-architecture';
|
|
3
2
|
export declare type DeployFunctionInput = {
|
|
4
3
|
createCloudWatchLogGroup: boolean;
|
|
5
4
|
cloudWatchLogRetentionPeriodInDays?: number;
|
|
6
5
|
region: AwsRegion;
|
|
7
6
|
timeoutInSeconds: number;
|
|
8
7
|
memorySizeInMb: number;
|
|
9
|
-
architecture: LambdaArchitecture;
|
|
10
8
|
diskSizeInMb?: number;
|
|
11
9
|
customRoleArn?: string;
|
|
12
10
|
};
|
|
@@ -22,7 +20,6 @@ export declare type DeployFunctionOutput = {
|
|
|
22
20
|
* @param options.region The region you want to deploy your function to.
|
|
23
21
|
* @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
|
|
24
22
|
* @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
|
|
26
23
|
* @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
|
|
27
24
|
* @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
|
|
28
25
|
*/
|
|
@@ -7,7 +7,6 @@ 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");
|
|
11
10
|
const validate_aws_region_1 = require("../shared/validate-aws-region");
|
|
12
11
|
const validate_custom_role_arn_1 = require("../shared/validate-custom-role-arn");
|
|
13
12
|
const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
|
|
@@ -23,7 +22,6 @@ const create_function_1 = require("./create-function");
|
|
|
23
22
|
* @param options.region The region you want to deploy your function to.
|
|
24
23
|
* @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
|
|
25
24
|
* @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
|
|
27
25
|
* @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
|
|
28
26
|
* @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
|
|
29
27
|
*/
|
|
@@ -34,7 +32,6 @@ const deployFunction = async (options) => {
|
|
|
34
32
|
(0, validate_timeout_1.validateTimeout)(options.timeoutInSeconds);
|
|
35
33
|
(0, validate_aws_region_1.validateAwsRegion)(options.region);
|
|
36
34
|
(0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
|
|
37
|
-
(0, validate_architecture_1.validateArchitecture)(options.architecture);
|
|
38
35
|
(0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
|
|
39
36
|
(0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
|
|
40
37
|
const fnNameRender = [
|
|
@@ -55,16 +52,13 @@ const deployFunction = async (options) => {
|
|
|
55
52
|
const created = await (0, create_function_1.createFunction)({
|
|
56
53
|
createCloudWatchLogGroup: options.createCloudWatchLogGroup,
|
|
57
54
|
region: options.region,
|
|
58
|
-
zipFile:
|
|
59
|
-
? function_zip_path_1.FUNCTION_ZIP_ARM64
|
|
60
|
-
: function_zip_path_1.FUNCTION_ZIP_X86_64,
|
|
55
|
+
zipFile: function_zip_path_1.FUNCTION_ZIP_ARM64,
|
|
61
56
|
functionName: fnNameRender,
|
|
62
57
|
accountId,
|
|
63
58
|
memorySizeInMb: options.memorySizeInMb,
|
|
64
59
|
timeoutInSeconds: options.timeoutInSeconds,
|
|
65
60
|
retentionInDays: (_b = options.cloudWatchLogRetentionPeriodInDays) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
|
|
66
61
|
alreadyCreated: Boolean(alreadyDeployed),
|
|
67
|
-
architecture: options.architecture,
|
|
68
62
|
ephemerealStorageInMb: diskSizeInMb,
|
|
69
63
|
customRoleArn: options.customRoleArn,
|
|
70
64
|
});
|
package/dist/api/deploy-site.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.deploySite = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const io_1 = require("../functions/helpers/io");
|
|
9
9
|
const bundle_site_1 = require("../shared/bundle-site");
|
|
10
10
|
const constants_1 = require("../shared/constants");
|
|
@@ -87,14 +87,9 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
|
|
|
87
87
|
})),
|
|
88
88
|
]);
|
|
89
89
|
if (!process.env.VITEST) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
fs_1.default.rmdirSync(bundled, { recursive: true });
|
|
97
|
-
}
|
|
90
|
+
node_fs_1.default.rmSync(bundled, {
|
|
91
|
+
recursive: true,
|
|
92
|
+
});
|
|
98
93
|
}
|
|
99
94
|
return {
|
|
100
95
|
serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
|
|
@@ -25,7 +25,3 @@ 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,9 +3,9 @@ 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.
|
|
6
|
+
exports.downloadMedia = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
|
-
const
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const expected_out_name_1 = require("../functions/helpers/expected-out-name");
|
|
10
10
|
const get_render_metadata_1 = require("../functions/helpers/get-render-metadata");
|
|
11
11
|
const read_with_progress_1 = require("../functions/helpers/read-with-progress");
|
|
@@ -32,7 +32,7 @@ const downloadMedia = async (input) => {
|
|
|
32
32
|
region: input.region,
|
|
33
33
|
renderId: input.renderId,
|
|
34
34
|
});
|
|
35
|
-
const outputPath =
|
|
35
|
+
const outputPath = node_path_1.default.resolve(process.cwd(), input.outPath);
|
|
36
36
|
renderer_1.RenderInternals.ensureOutputDirectory(outputPath);
|
|
37
37
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
|
|
38
38
|
const { sizeInBytes } = await (0, read_with_progress_1.lambdaDownloadFileWithProgress)({
|
|
@@ -50,7 +50,3 @@ 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,11 +1,9 @@
|
|
|
1
1
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
|
-
import type { LambdaArchitecture } from '../shared/validate-architecture';
|
|
3
2
|
export declare type EstimatePriceInput = {
|
|
4
3
|
region: AwsRegion;
|
|
5
4
|
durationInMiliseconds: number;
|
|
6
5
|
memorySizeInMb: number;
|
|
7
6
|
diskSizeInMb: number;
|
|
8
|
-
architecture: LambdaArchitecture;
|
|
9
7
|
lambdasInvoked: number;
|
|
10
8
|
};
|
|
11
9
|
/**
|
|
@@ -14,4 +12,4 @@ export declare type EstimatePriceInput = {
|
|
|
14
12
|
* @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
|
|
15
13
|
* @returns {number} Price in USD
|
|
16
14
|
*/
|
|
17
|
-
export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb,
|
|
15
|
+
export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }: EstimatePriceInput) => number;
|
|
@@ -3,7 +3,6 @@ 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");
|
|
7
6
|
const validate_aws_region_1 = require("../shared/validate-aws-region");
|
|
8
7
|
const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
|
|
9
8
|
const validate_memory_size_1 = require("../shared/validate-memory-size");
|
|
@@ -13,10 +12,9 @@ const validate_memory_size_1 = require("../shared/validate-memory-size");
|
|
|
13
12
|
* @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
|
|
14
13
|
* @returns {number} Price in USD
|
|
15
14
|
*/
|
|
16
|
-
const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb,
|
|
15
|
+
const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }) => {
|
|
17
16
|
(0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
|
|
18
17
|
(0, validate_aws_region_1.validateAwsRegion)(region);
|
|
19
|
-
(0, validate_architecture_1.validateArchitecture)(architecture);
|
|
20
18
|
(0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
|
|
21
19
|
if (typeof durationInMiliseconds !== 'number') {
|
|
22
20
|
throw new TypeError(`Parameter 'durationInMiliseconds' must be a number but got ${typeof durationInMiliseconds}`);
|
|
@@ -30,15 +28,11 @@ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSize
|
|
|
30
28
|
if (durationInMiliseconds < 0) {
|
|
31
29
|
throw new TypeError(`Parameter 'durationInMiliseconds' must be over 0 but it is ${durationInMiliseconds}.`);
|
|
32
30
|
}
|
|
33
|
-
const durationPrice =
|
|
34
|
-
? price_per_1_s_1.pricing[region]['Lambda Duration'].price
|
|
35
|
-
: price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
|
|
31
|
+
const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
|
|
36
32
|
// In GB-second
|
|
37
33
|
const timeCostDollars = Number(durationPrice) *
|
|
38
34
|
((memorySizeInMb * durationInMiliseconds) / 1000 / 1024);
|
|
39
|
-
const diskSizePrice =
|
|
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;
|
|
35
|
+
const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
|
|
42
36
|
const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
|
|
43
37
|
// In GB-second
|
|
44
38
|
const diskSizeDollars = chargedDiskSize *
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyCompMetadata } 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 =
|
|
16
|
+
export declare type GetCompositionsOnLambdaOutput = AnyCompMetadata[];
|
|
17
17
|
/**
|
|
18
18
|
* @description Returns the compositions from a serveUrl
|
|
19
19
|
* @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
|
|
@@ -12,13 +12,11 @@ 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;
|
|
16
15
|
const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
|
|
17
16
|
if (remotionBuckets.length > 1) {
|
|
18
17
|
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.`);
|
|
19
18
|
}
|
|
20
19
|
if (remotionBuckets.length === 1) {
|
|
21
|
-
(_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
22
20
|
return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
|
|
23
21
|
}
|
|
24
22
|
const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
|
|
@@ -26,7 +24,6 @@ const getOrCreateBucket = async (options) => {
|
|
|
26
24
|
bucketName,
|
|
27
25
|
region: options.region,
|
|
28
26
|
});
|
|
29
|
-
(_b = options.onBucketEnsured) === null || _b === void 0 ? void 0 : _b.call(options);
|
|
30
27
|
return { bucketName, alreadyExisted: false };
|
|
31
28
|
};
|
|
32
29
|
exports.getOrCreateBucket = getOrCreateBucket;
|
package/dist/api/get-sites.d.ts
CHANGED
|
@@ -36,10 +36,12 @@ const simulatePermissions = async (options) => {
|
|
|
36
36
|
}
|
|
37
37
|
const callerIdentityArnType = callerIdentityArnComponents[1];
|
|
38
38
|
let callerArn;
|
|
39
|
-
if (callerIdentityArnType === 'iam' &&
|
|
39
|
+
if (callerIdentityArnType === 'iam' &&
|
|
40
|
+
callerIdentityArnComponents[3] === 'user') {
|
|
40
41
|
callerArn = callerIdentity.Arn;
|
|
41
42
|
}
|
|
42
|
-
else if (callerIdentityArnType === 'sts' &&
|
|
43
|
+
else if (callerIdentityArnType === 'sts' &&
|
|
44
|
+
callerIdentityArnComponents[3] === 'assumed-role') {
|
|
43
45
|
const assumedRoleComponents = callerIdentityArnComponents[4].match(/\/([^/]+)\/(.*)/);
|
|
44
46
|
if (!assumedRoleComponents) {
|
|
45
47
|
throw new Error('Unsupported AWS Caller Identity as Assumed-Role ARN detected');
|