@remotion/lambda 4.0.186 → 4.0.188
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/api/__mocks__/clean-items.d.ts +2 -0
- package/dist/api/__mocks__/clean-items.js +24 -0
- package/dist/api/__mocks__/create-function.d.ts +2 -0
- package/dist/api/__mocks__/create-function.js +21 -0
- package/dist/api/__mocks__/delete-function.d.ts +2 -0
- package/dist/api/__mocks__/delete-function.js +9 -0
- package/dist/api/__mocks__/get-functions.d.ts +2 -0
- package/dist/api/__mocks__/get-functions.js +9 -0
- package/dist/api/__mocks__/upload-dir.d.ts +3 -0
- package/dist/api/__mocks__/upload-dir.js +47 -0
- package/dist/api/bucket-exists.d.ts +3 -6
- package/dist/api/bucket-exists.js +5 -5
- package/dist/api/clean-items.d.ts +4 -3
- package/dist/api/clean-items.js +7 -7
- package/dist/api/create-bucket.d.ts +3 -5
- package/dist/api/create-bucket.js +6 -6
- package/dist/api/create-function.d.ts +1 -1
- package/dist/api/delete-function.d.ts +1 -1
- package/dist/api/delete-render.d.ts +10 -3
- package/dist/api/delete-render.js +27 -19
- package/dist/api/delete-site.d.ts +7 -2
- package/dist/api/delete-site.js +23 -15
- package/dist/api/deploy-function.d.ts +1 -1
- package/dist/api/deploy-function.js +2 -2
- package/dist/api/deploy-site.d.ts +9 -5
- package/dist/api/deploy-site.js +11 -12
- package/dist/api/download-media.d.ts +8 -3
- package/dist/api/download-media.js +24 -15
- package/dist/api/estimate-price.d.ts +1 -1
- package/dist/api/get-aws-client.d.ts +4 -2
- package/dist/api/get-aws-client.js +2 -2
- package/dist/api/get-buckets.d.ts +4 -4
- package/dist/api/get-buckets.js +12 -14
- package/dist/api/get-compositions-on-lambda.js +7 -6
- package/dist/api/get-function-info.d.ts +1 -1
- package/dist/api/get-functions.d.ts +1 -1
- package/dist/api/get-or-create-bucket.d.ts +3 -19
- package/dist/api/get-or-create-bucket.js +5 -39
- package/dist/api/get-regions.d.ts +1 -1
- package/dist/api/get-regions.js +1 -2
- package/dist/api/get-render-progress.d.ts +4 -3
- package/dist/api/get-render-progress.js +2 -2
- package/dist/api/get-sites.d.ts +6 -1
- package/dist/api/get-sites.js +21 -14
- package/dist/api/iam-validation/role-permissions.js +2 -1
- package/dist/api/iam-validation/simulate-rule.d.ts +1 -1
- package/dist/api/iam-validation/simulate.d.ts +1 -1
- package/dist/api/iam-validation/user-permissions.js +2 -1
- package/dist/api/make-lambda-payload.d.ts +8 -9
- package/dist/api/make-lambda-payload.js +15 -13
- package/dist/api/mock-functions.d.ts +1 -1
- package/dist/api/presign-url.d.ts +1 -1
- package/dist/api/presign-url.js +4 -4
- package/dist/api/render-media-on-lambda.d.ts +5 -6
- package/dist/api/render-media-on-lambda.js +5 -5
- package/dist/api/render-still-on-lambda.d.ts +8 -6
- package/dist/api/render-still-on-lambda.js +6 -5
- package/dist/api/upload-dir.d.ts +2 -2
- package/dist/api/upload-dir.js +2 -2
- package/dist/cli/args.d.ts +2 -3
- package/dist/cli/commands/render/progress.d.ts +2 -2
- package/dist/cli/commands/render/progress.js +6 -5
- package/dist/cli/commands/render/render.d.ts +3 -1
- package/dist/cli/commands/render/render.js +3 -2
- package/dist/cli/commands/sites/create.d.ts +3 -1
- package/dist/cli/commands/sites/create.js +6 -5
- package/dist/cli/commands/sites/index.d.ts +3 -1
- package/dist/cli/commands/sites/index.js +4 -4
- package/dist/cli/commands/sites/rm.d.ts +3 -1
- package/dist/cli/commands/sites/rm.js +4 -3
- package/dist/cli/commands/sites/rmall.d.ts +3 -1
- package/dist/cli/commands/sites/rmall.js +4 -3
- package/dist/cli/commands/still.d.ts +3 -1
- package/dist/cli/commands/still.js +3 -2
- package/dist/cli/get-aws-region.d.ts +1 -1
- package/dist/cli/helpers/__mocks__/quit.d.ts +1 -0
- package/dist/cli/helpers/__mocks__/quit.js +7 -0
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +8 -7
- package/dist/client.d.ts +4 -5
- package/dist/functions/aws-implementation.d.ts +11 -0
- package/dist/functions/aws-implementation.js +49 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/compositions.d.ts +3 -2
- package/dist/functions/compositions.js +18 -15
- package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +3 -0
- package/dist/functions/helpers/__mocks__/get-browser-instance.js +12 -0
- package/dist/functions/helpers/__mocks__/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/__mocks__/leak-detection.js +9 -0
- package/dist/functions/helpers/__mocks__/timer.d.ts +2 -0
- package/dist/functions/helpers/__mocks__/timer.js +10 -0
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +5 -3
- package/dist/functions/helpers/calculate-price-from-bucket.js +2 -3
- package/dist/functions/helpers/cleanup-props.d.ts +4 -2
- package/dist/functions/helpers/cleanup-props.js +5 -4
- package/dist/functions/helpers/concat-videos.d.ts +2 -2
- package/dist/functions/helpers/create-post-render-data.d.ts +8 -8
- package/dist/functions/helpers/create-post-render-data.js +1 -1
- package/dist/functions/helpers/expected-out-name.d.ts +4 -4
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +8 -7
- package/dist/functions/helpers/find-output-file-in-bucket.js +5 -6
- package/dist/functions/helpers/get-browser-instance.d.ts +3 -2
- package/dist/functions/helpers/get-browser-instance.js +3 -4
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-current-region.js +3 -3
- package/dist/functions/helpers/get-custom-out-name.d.ts +5 -5
- package/dist/functions/helpers/get-folder-files.d.ts +2 -0
- package/dist/functions/helpers/get-folder-files.js +38 -0
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +4 -3
- package/dist/functions/helpers/get-output-url-from-metadata.js +4 -5
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +5 -4
- package/dist/functions/helpers/get-overall-progress-s3.js +5 -7
- package/dist/functions/helpers/get-progress.d.ts +8 -7
- package/dist/functions/helpers/get-progress.js +7 -5
- package/dist/functions/helpers/inspect-errors.d.ts +1 -1
- package/dist/functions/helpers/inspect-errors.js +4 -4
- package/dist/functions/helpers/io.d.ts +3 -36
- package/dist/functions/helpers/io.js +3 -104
- package/dist/functions/helpers/lifecycle.d.ts +3 -9
- package/dist/functions/helpers/lifecycle.js +6 -16
- package/dist/functions/helpers/make-aws-artifact.d.ts +3 -0
- package/dist/functions/helpers/make-aws-artifact.js +12 -0
- package/dist/functions/helpers/make-timeout-error.d.ts +5 -4
- package/dist/functions/helpers/make-timeout-error.js +2 -1
- package/dist/functions/helpers/make-timeout-message.d.ts +5 -3
- package/dist/functions/helpers/make-timeout-message.js +8 -9
- package/dist/functions/helpers/merge-chunks.d.ts +10 -10
- package/dist/functions/helpers/merge-chunks.js +7 -8
- package/dist/functions/helpers/overall-render-progress.d.ts +18 -23
- package/dist/functions/helpers/overall-render-progress.js +5 -5
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +2 -2
- package/dist/functions/helpers/print-logging-helper.d.ts +4 -0
- package/dist/functions/helpers/print-logging-helper.js +12 -0
- package/dist/functions/helpers/read-with-progress.d.ts +4 -3
- package/dist/functions/helpers/read-with-progress.js +2 -2
- package/dist/functions/helpers/render-has-audio-video.d.ts +3 -2
- package/dist/functions/helpers/stream-renderer.d.ts +7 -4
- package/dist/functions/helpers/stream-renderer.js +11 -10
- package/dist/functions/helpers/streamify-response.d.ts +0 -20
- package/dist/functions/helpers/streamify-response.js +1 -62
- package/dist/functions/helpers/validate-composition.d.ts +5 -3
- package/dist/functions/helpers/validate-composition.js +2 -3
- package/dist/functions/index.d.ts +5 -3
- package/dist/functions/index.js +98 -72
- package/dist/functions/info.d.ts +1 -1
- package/dist/functions/info.js +2 -2
- package/dist/functions/launch.d.ts +3 -2
- package/dist/functions/launch.js +54 -41
- package/dist/functions/progress.d.ts +6 -3
- package/dist/functions/progress.js +5 -4
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +1 -0
- package/dist/functions/renderer.d.ts +9 -3
- package/dist/functions/renderer.js +30 -22
- package/dist/functions/start.d.ts +3 -2
- package/dist/functions/start.js +13 -16
- package/dist/functions/still.d.ts +8 -18
- package/dist/functions/still.js +47 -46
- package/dist/index.d.ts +4 -6
- package/dist/internals.d.ts +15 -13
- package/dist/io/delete-file.d.ts +3 -0
- package/dist/io/delete-file.js +12 -0
- package/dist/io/head-file.d.ts +3 -0
- package/dist/io/head-file.js +13 -0
- package/dist/io/list-objects.d.ts +3 -0
- package/dist/io/list-objects.js +58 -0
- package/dist/io/read-file.d.ts +9 -0
- package/dist/io/read-file.js +14 -0
- package/dist/io/write-file.d.ts +5 -0
- package/dist/io/write-file.js +51 -0
- package/dist/pricing/aws-regions.d.ts +0 -3
- package/dist/pricing/aws-regions.js +0 -44
- package/dist/pricing/price-per-1-s.d.ts +1 -1
- package/dist/regions.d.ts +3 -2
- package/dist/regions.js +43 -3
- package/dist/shared/__mocks__/aws-clients.d.ts +2 -0
- package/dist/shared/__mocks__/aws-clients.js +62 -0
- package/dist/shared/__mocks__/bundle-site.d.ts +2 -0
- package/dist/shared/__mocks__/bundle-site.js +32 -0
- package/dist/shared/__mocks__/check-credentials.d.ts +1 -0
- package/dist/shared/__mocks__/check-credentials.js +5 -0
- package/dist/shared/__mocks__/get-account-id.d.ts +2 -0
- package/dist/shared/__mocks__/get-account-id.js +11 -0
- package/dist/shared/__mocks__/read-dir.d.ts +2 -0
- package/dist/shared/__mocks__/read-dir.js +13 -0
- package/dist/shared/aws-clients.d.ts +6 -29
- package/dist/shared/aws-clients.js +7 -177
- package/dist/shared/call-lambda.d.ts +8 -9
- package/dist/shared/call-lambda.js +16 -3
- package/dist/shared/check-credentials.js +2 -2
- package/dist/shared/cleanup-serialized-input-props.d.ts +8 -6
- package/dist/shared/cleanup-serialized-input-props.js +7 -8
- package/dist/shared/compress-props.d.ts +8 -6
- package/dist/shared/compress-props.js +11 -14
- package/dist/shared/constants.d.ts +10 -288
- package/dist/shared/constants.js +1 -46
- package/dist/shared/content-disposition-header.d.ts +1 -6
- package/dist/shared/content-disposition-header.js +2 -2
- package/dist/shared/convert-to-serve-url.d.ts +2 -2
- package/dist/shared/convert-to-serve-url.js +3 -3
- package/dist/shared/get-account-id.d.ts +1 -1
- package/dist/shared/get-aws-urls.d.ts +2 -2
- package/dist/shared/get-credentials.d.ts +9 -0
- package/dist/shared/get-credentials.js +53 -0
- package/dist/shared/get-function-version.d.ts +1 -1
- package/dist/shared/get-function-version.js +2 -1
- package/dist/shared/get-s3-client.d.ts +5 -0
- package/dist/shared/get-s3-client.js +13 -0
- package/dist/shared/get-service-client.d.ts +22 -0
- package/dist/shared/get-service-client.js +117 -0
- package/dist/shared/hosted-layers.d.ts +1 -1
- package/dist/shared/invoke-webhook.d.ts +1 -1
- package/dist/shared/lambda-insights-extensions.d.ts +1 -1
- package/dist/shared/lifecycle-rules.d.ts +4 -3
- package/dist/shared/lifecycle-rules.js +3 -3
- package/dist/shared/make-s3-url.d.ts +1 -1
- package/dist/shared/random-hash.d.ts +1 -3
- package/dist/shared/random-hash.js +3 -4
- package/dist/shared/return-values.d.ts +10 -11
- package/dist/shared/validate-aws-region.d.ts +1 -1
- package/dist/shared/validate-aws-region.js +3 -3
- package/dist/shared/validate-bucketname.d.ts +0 -4
- package/dist/shared/validate-bucketname.js +3 -23
- package/dist/shared/validate-lambda-codec.d.ts +2 -4
- package/dist/shared/validate-lambda-codec.js +3 -13
- package/dist/shared/validate-outname.js +2 -2
- package/dist/shared/validate-privacy.d.ts +1 -1
- package/dist/shared/validate-webhook.d.ts +1 -1
- package/package.json +11 -9
- package/remotionlambda-arm64.zip +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { CloudProvider } from '@remotion/serverless';
|
|
2
|
+
import type { RenderMetadata } from '@remotion/serverless/client';
|
|
3
|
+
import { type CustomCredentials } from '@remotion/serverless/client';
|
|
4
|
+
export declare const getOutputUrlFromMetadata: <Provider extends CloudProvider<string, Record<string, unknown>>>(renderMetadata: RenderMetadata<Provider>, bucketName: string, customCredentials: CustomCredentials<Provider> | null, currentRegion: Provider["region"]) => {
|
|
4
5
|
url: string;
|
|
5
6
|
key: string;
|
|
6
7
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOutputUrlFromMetadata = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const { key, renderBucketName } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, customCredentials);
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
|
+
const getOutputUrlFromMetadata = (renderMetadata, bucketName, customCredentials, currentRegion) => {
|
|
6
|
+
const { key, renderBucketName } = (0, client_1.getExpectedOutName)(renderMetadata, bucketName, customCredentials);
|
|
8
7
|
return {
|
|
9
|
-
url: `https://s3.${
|
|
8
|
+
url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
|
|
10
9
|
key,
|
|
11
10
|
};
|
|
12
11
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
2
|
import type { OverallRenderProgress } from './overall-render-progress';
|
|
3
|
-
export declare const getOverallProgressS3: ({ renderId, bucketName, expectedBucketOwner, region, }: {
|
|
3
|
+
export declare const getOverallProgressS3: <Provider extends CloudProvider<string, Record<string, unknown>>>({ renderId, bucketName, expectedBucketOwner, region, providerSpecifics, }: {
|
|
4
4
|
renderId: string;
|
|
5
5
|
expectedBucketOwner: string;
|
|
6
6
|
bucketName: string;
|
|
7
|
-
region:
|
|
8
|
-
|
|
7
|
+
region: Provider["region"];
|
|
8
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
9
|
+
}) => Promise<OverallRenderProgress<Provider>>;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOverallProgressS3 = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const io_1 = require("./io");
|
|
7
|
-
const getOverallProgressS3 = async ({ renderId, bucketName, expectedBucketOwner, region, }) => {
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
|
+
const getOverallProgressS3 = async ({ renderId, bucketName, expectedBucketOwner, region, providerSpecifics, }) => {
|
|
8
6
|
try {
|
|
9
|
-
const Body = await
|
|
7
|
+
const Body = await providerSpecifics.readFile({
|
|
10
8
|
bucketName,
|
|
11
|
-
key: (0,
|
|
9
|
+
key: (0, client_1.overallProgressKey)(renderId),
|
|
12
10
|
expectedBucketOwner,
|
|
13
11
|
region,
|
|
14
12
|
});
|
|
15
|
-
const str = await (0,
|
|
13
|
+
const str = await (0, client_1.streamToString)(Body);
|
|
16
14
|
return JSON.parse(str);
|
|
17
15
|
}
|
|
18
16
|
catch (err) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
4
|
-
export declare const getProgress: ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMilliseconds, customCredentials, }: {
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import { type CustomCredentials } from '@remotion/serverless/client';
|
|
3
|
+
import type { GenericRenderProgress } from '../../shared/constants';
|
|
4
|
+
export declare const getProgress: <Provider extends CloudProvider<string, Record<string, unknown>>>({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMilliseconds, customCredentials, providerSpecifics, }: {
|
|
5
5
|
bucketName: string;
|
|
6
6
|
renderId: string;
|
|
7
7
|
expectedBucketOwner: string;
|
|
8
|
-
region:
|
|
8
|
+
region: Provider["region"];
|
|
9
9
|
memorySizeInMb: number;
|
|
10
10
|
timeoutInMilliseconds: number;
|
|
11
|
-
customCredentials: CustomCredentials | null;
|
|
12
|
-
|
|
11
|
+
customCredentials: CustomCredentials<Provider> | null;
|
|
12
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
13
|
+
}) => Promise<GenericRenderProgress<Provider>>;
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProgress = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
6
|
const no_react_1 = require("remotion/no-react");
|
|
6
7
|
const constants_1 = require("../../shared/constants");
|
|
7
|
-
const truthy_1 = require("../../shared/truthy");
|
|
8
8
|
const calculate_chunk_times_1 = require("./calculate-chunk-times");
|
|
9
9
|
const calculate_price_from_bucket_1 = require("./calculate-price-from-bucket");
|
|
10
|
-
const expected_out_name_1 = require("./expected-out-name");
|
|
11
10
|
const format_costs_info_1 = require("./format-costs-info");
|
|
12
11
|
const get_overall_progress_1 = require("./get-overall-progress");
|
|
13
12
|
const get_overall_progress_s3_1 = require("./get-overall-progress-s3");
|
|
14
13
|
const inspect_errors_1 = require("./inspect-errors");
|
|
15
14
|
const make_timeout_error_1 = require("./make-timeout-error");
|
|
16
15
|
const render_has_audio_video_1 = require("./render-has-audio-video");
|
|
17
|
-
const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMilliseconds, customCredentials, }) => {
|
|
16
|
+
const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMilliseconds, customCredentials, providerSpecifics, }) => {
|
|
18
17
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
19
18
|
const overallProgress = await (0, get_overall_progress_s3_1.getOverallProgressS3)({
|
|
20
19
|
renderId,
|
|
21
20
|
bucketName,
|
|
22
21
|
expectedBucketOwner,
|
|
23
22
|
region,
|
|
23
|
+
providerSpecifics,
|
|
24
24
|
});
|
|
25
25
|
if (overallProgress.postRenderData) {
|
|
26
26
|
if (!overallProgress.renderMetadata) {
|
|
27
27
|
throw new Error('No render metadata found even though render is finished');
|
|
28
28
|
}
|
|
29
|
-
const outData = (0,
|
|
29
|
+
const outData = (0, client_1.getExpectedOutName)(overallProgress.renderMetadata, bucketName, customCredentials);
|
|
30
30
|
const totalFrameCount = overallProgress.renderMetadata.type === 'still'
|
|
31
31
|
? 1
|
|
32
32
|
: renderer_1.RenderInternals.getFramesToRender(overallProgress.renderMetadata.frameRange, overallProgress.renderMetadata.everyNthFrame).length;
|
|
@@ -95,6 +95,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
95
95
|
// overestimate the price, but will only have a miniscule effect (~0.2%)
|
|
96
96
|
diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
97
97
|
timings: (_c = overallProgress.timings) !== null && _c !== void 0 ? _c : [],
|
|
98
|
+
providerSpecifics,
|
|
98
99
|
});
|
|
99
100
|
const { hasAudio, hasVideo } = renderMetadata
|
|
100
101
|
? (0, render_has_audio_video_1.lambdaRenderHasAudioVideo)(renderMetadata)
|
|
@@ -104,7 +105,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
104
105
|
minFilesToDelete: 0,
|
|
105
106
|
filesDeleted: 0,
|
|
106
107
|
};
|
|
107
|
-
const chunkMultiplier = [hasAudio, hasVideo].filter(
|
|
108
|
+
const chunkMultiplier = [hasAudio, hasVideo].filter(client_1.truthy).length;
|
|
108
109
|
const allChunks = ((_d = overallProgress.chunks) !== null && _d !== void 0 ? _d : []).length / chunkMultiplier ===
|
|
109
110
|
((_e = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _e !== void 0 ? _e : Infinity);
|
|
110
111
|
const frameCount = renderMetadata
|
|
@@ -136,6 +137,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
136
137
|
renderMetadata,
|
|
137
138
|
renderId,
|
|
138
139
|
missingChunks: missingChunks !== null && missingChunks !== void 0 ? missingChunks : [],
|
|
140
|
+
providerSpecifics,
|
|
139
141
|
})
|
|
140
142
|
: null,
|
|
141
143
|
...errorExplanations,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EnhancedErrorInfo, type LambdaErrorInfo } from '@remotion/serverless';
|
|
2
2
|
export declare const inspectErrors: ({ errors, }: {
|
|
3
3
|
errors: LambdaErrorInfo[];
|
|
4
4
|
}) => EnhancedErrorInfo[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.inspectErrors = void 0;
|
|
4
|
+
const serverless_1 = require("@remotion/serverless");
|
|
4
5
|
const docs_url_1 = require("../../shared/docs-url");
|
|
5
|
-
const is_enosp_err_1 = require("./is-enosp-err");
|
|
6
6
|
const FAILED_TO_LAUNCH_TOKEN = 'Failed to launch browser.';
|
|
7
7
|
const getExplanation = (stack) => {
|
|
8
8
|
if (stack.includes('FATAL:zygote_communication_linux.cc')) {
|
|
@@ -16,13 +16,13 @@ const getExplanation = (stack) => {
|
|
|
16
16
|
if (stack.includes('TooManyRequestsException')) {
|
|
17
17
|
return `AWS returned an "TooManyRequestsException" error message which could mean you reached the concurrency limit of AWS Lambda. You can increase the limit - read this troubleshooting page: ${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/rate-limit`;
|
|
18
18
|
}
|
|
19
|
-
if ((0,
|
|
19
|
+
if ((0, serverless_1.errorIsOutOfSpaceError)(stack)) {
|
|
20
20
|
return `Your lambda function reached the storage limit. Reduce the amount of space needed per lambda function or increase the storage limit: ${docs_url_1.DOCS_URL}/docs/lambda/disk-size.`;
|
|
21
21
|
}
|
|
22
|
-
if ((0,
|
|
22
|
+
if ((0, serverless_1.isErrInsufficientResourcesErr)(stack)) {
|
|
23
23
|
return 'The lambda ran out of memory. Deploy a new function with more memory.';
|
|
24
24
|
}
|
|
25
|
-
if ((0,
|
|
25
|
+
if ((0, serverless_1.isBrowserCrashedError)(stack)) {
|
|
26
26
|
return 'The browser crashed while rendering the video. Deploy a new function with memory to give the browser more resources.';
|
|
27
27
|
}
|
|
28
28
|
return null;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
7
|
-
import type { CustomCredentials } from '../../shared/aws-clients';
|
|
8
|
-
import type { Privacy } from '../../shared/constants';
|
|
9
|
-
import type { DownloadBehavior } from '../../shared/content-disposition-header';
|
|
2
|
+
import type { CustomCredentials } from '@remotion/serverless/client';
|
|
3
|
+
import type { AwsRegion } from '../../regions';
|
|
10
4
|
export type LambdaLSInput = {
|
|
11
5
|
bucketName: string;
|
|
12
6
|
prefix: string;
|
|
@@ -15,39 +9,12 @@ export type LambdaLSInput = {
|
|
|
15
9
|
continuationToken?: string;
|
|
16
10
|
};
|
|
17
11
|
export type LambdaLsReturnType = Promise<_Object[]>;
|
|
18
|
-
export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
|
|
19
|
-
export declare const lambdaDeleteFile: ({ bucketName, key, region, customCredentials, }: {
|
|
20
|
-
region: AwsRegion;
|
|
21
|
-
bucketName: string;
|
|
22
|
-
key: string;
|
|
23
|
-
customCredentials: CustomCredentials | null;
|
|
24
|
-
}) => Promise<void>;
|
|
25
|
-
type LambdaWriteFileInput = {
|
|
26
|
-
bucketName: string;
|
|
27
|
-
key: string;
|
|
28
|
-
body: ReadStream | string | Uint8Array;
|
|
29
|
-
region: AwsRegion;
|
|
30
|
-
privacy: Privacy;
|
|
31
|
-
expectedBucketOwner: string | null;
|
|
32
|
-
downloadBehavior: DownloadBehavior | null;
|
|
33
|
-
customCredentials: CustomCredentials | null;
|
|
34
|
-
};
|
|
35
|
-
export declare const lambdaWriteFile: (params: LambdaWriteFileInput & {
|
|
36
|
-
retries?: number;
|
|
37
|
-
}) => Promise<void>;
|
|
38
|
-
export declare const lambdaReadFile: ({ bucketName, key, region, expectedBucketOwner, }: {
|
|
39
|
-
bucketName: string;
|
|
40
|
-
key: string;
|
|
41
|
-
region: AwsRegion;
|
|
42
|
-
expectedBucketOwner: string;
|
|
43
|
-
}) => Promise<Readable>;
|
|
44
12
|
export declare const lambdaHeadCommand: ({ bucketName, key, region, customCredentials, }: {
|
|
45
13
|
bucketName: string;
|
|
46
14
|
key: string;
|
|
47
15
|
region: AwsRegion;
|
|
48
|
-
customCredentials: CustomCredentials | null;
|
|
16
|
+
customCredentials: CustomCredentials<AwsRegion> | null;
|
|
49
17
|
}) => Promise<{
|
|
50
18
|
LastModified?: Date | undefined;
|
|
51
19
|
ContentLength?: number | undefined;
|
|
52
20
|
}>;
|
|
53
|
-
export {};
|
|
@@ -1,111 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.lambdaHeadCommand =
|
|
3
|
+
exports.lambdaHeadCommand = void 0;
|
|
7
4
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
|
-
const
|
|
9
|
-
const aws_clients_1 = require("../../shared/aws-clients");
|
|
10
|
-
const content_disposition_header_1 = require("../../shared/content-disposition-header");
|
|
11
|
-
const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }) => {
|
|
12
|
-
var _a, _b, _c;
|
|
13
|
-
try {
|
|
14
|
-
const list = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.ListObjectsV2Command({
|
|
15
|
-
Bucket: bucketName,
|
|
16
|
-
Prefix: prefix,
|
|
17
|
-
ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
|
|
18
|
-
ContinuationToken: continuationToken,
|
|
19
|
-
}));
|
|
20
|
-
if (list.NextContinuationToken) {
|
|
21
|
-
return [
|
|
22
|
-
...((_a = list.Contents) !== null && _a !== void 0 ? _a : []),
|
|
23
|
-
...(await (0, exports.lambdaLs)({
|
|
24
|
-
bucketName,
|
|
25
|
-
prefix,
|
|
26
|
-
expectedBucketOwner,
|
|
27
|
-
region,
|
|
28
|
-
continuationToken: list.NextContinuationToken,
|
|
29
|
-
})),
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
return (_b = list.Contents) !== null && _b !== void 0 ? _b : [];
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
if (!expectedBucketOwner) {
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
// Prevent from accessing a foreign bucket, retry without ExpectedBucketOwner and see if it works. If it works then it's an owner mismatch.
|
|
39
|
-
if ((_c = err.stack) === null || _c === void 0 ? void 0 : _c.includes('AccessDenied')) {
|
|
40
|
-
await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.ListObjectsV2Command({
|
|
41
|
-
Bucket: bucketName,
|
|
42
|
-
Prefix: prefix,
|
|
43
|
-
}));
|
|
44
|
-
throw new Error(`Bucket owner mismatch: Expected the bucket ${bucketName} to be owned by you (AWS Account ID: ${expectedBucketOwner}) but it's not the case. Did you accidentially specify the wrong bucket?`);
|
|
45
|
-
}
|
|
46
|
-
throw err;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.lambdaLs = lambdaLs;
|
|
50
|
-
const lambdaDeleteFile = async ({ bucketName, key, region, customCredentials, }) => {
|
|
51
|
-
await (0, aws_clients_1.getS3Client)(region, customCredentials).send(new client_s3_1.DeleteObjectCommand({
|
|
52
|
-
Bucket: bucketName,
|
|
53
|
-
Key: key,
|
|
54
|
-
}));
|
|
55
|
-
};
|
|
56
|
-
exports.lambdaDeleteFile = lambdaDeleteFile;
|
|
57
|
-
const tryLambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, customCredentials, }) => {
|
|
58
|
-
await (0, aws_clients_1.getS3Client)(region, customCredentials).send(new client_s3_1.PutObjectCommand({
|
|
59
|
-
Bucket: bucketName,
|
|
60
|
-
Key: key,
|
|
61
|
-
Body: body,
|
|
62
|
-
ACL: privacy === 'no-acl'
|
|
63
|
-
? undefined
|
|
64
|
-
: privacy === 'private'
|
|
65
|
-
? 'private'
|
|
66
|
-
: 'public-read',
|
|
67
|
-
ExpectedBucketOwner: customCredentials
|
|
68
|
-
? undefined
|
|
69
|
-
: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
|
|
70
|
-
ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
|
|
71
|
-
ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
|
|
72
|
-
}));
|
|
73
|
-
};
|
|
74
|
-
const lambdaWriteFile = async (params) => {
|
|
75
|
-
var _a;
|
|
76
|
-
const remainingRetries = (_a = params.retries) !== null && _a !== void 0 ? _a : 2;
|
|
77
|
-
try {
|
|
78
|
-
await tryLambdaWriteFile(params);
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
if (remainingRetries === 0) {
|
|
82
|
-
throw err;
|
|
83
|
-
}
|
|
84
|
-
const backoff = 2 ** (2 - remainingRetries) * 2000;
|
|
85
|
-
await new Promise((resolve) => {
|
|
86
|
-
setTimeout(resolve, backoff);
|
|
87
|
-
});
|
|
88
|
-
console.warn('Failed to write file to Lambda:');
|
|
89
|
-
console.warn(err);
|
|
90
|
-
console.warn(`Retrying (${remainingRetries} retries remaining)...`);
|
|
91
|
-
return (0, exports.lambdaWriteFile)({
|
|
92
|
-
...params,
|
|
93
|
-
retries: remainingRetries - 1,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
exports.lambdaWriteFile = lambdaWriteFile;
|
|
98
|
-
const lambdaReadFile = async ({ bucketName, key, region, expectedBucketOwner, }) => {
|
|
99
|
-
const { Body } = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.GetObjectCommand({
|
|
100
|
-
Bucket: bucketName,
|
|
101
|
-
Key: key,
|
|
102
|
-
ExpectedBucketOwner: expectedBucketOwner,
|
|
103
|
-
}));
|
|
104
|
-
return Body;
|
|
105
|
-
};
|
|
106
|
-
exports.lambdaReadFile = lambdaReadFile;
|
|
5
|
+
const get_s3_client_1 = require("../../shared/get-s3-client");
|
|
107
6
|
const lambdaHeadCommand = async ({ bucketName, key, region, customCredentials, }) => {
|
|
108
|
-
const head = await (0,
|
|
7
|
+
const head = await (0, get_s3_client_1.getS3Client)(region, customCredentials).send(new client_s3_1.HeadObjectCommand({
|
|
109
8
|
Bucket: bucketName,
|
|
110
9
|
Key: key,
|
|
111
10
|
}));
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { LifecycleRule } from '@aws-sdk/client-s3';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly '3-days': 3;
|
|
5
|
-
readonly '7-days': 7;
|
|
6
|
-
readonly '30-days': 30;
|
|
7
|
-
};
|
|
8
|
-
export type DeleteAfter = keyof typeof expiryDays;
|
|
2
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
3
|
+
import type { DeleteAfter } from '@remotion/serverless/client';
|
|
9
4
|
export declare const getLifeCycleRules: () => LifecycleRule[];
|
|
10
|
-
export declare const generateRandomHashWithLifeCycleRule: (deleteAfter: DeleteAfter | null) => string;
|
|
5
|
+
export declare const generateRandomHashWithLifeCycleRule: <Provider extends CloudProvider<string, Record<string, unknown>>>(deleteAfter: DeleteAfter | null, providerSpecifics: ProviderSpecifics<Provider>) => string;
|
|
11
6
|
export declare const validateDeleteAfter: (lifeCycleValue: unknown) => void;
|
|
12
|
-
export {};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateDeleteAfter = exports.generateRandomHashWithLifeCycleRule = exports.getLifeCycleRules = void 0;
|
|
4
|
-
const
|
|
5
|
-
const truthy_1 = require("../../shared/truthy");
|
|
6
|
-
// Needs to be in sync with renderer/src/options/delete-after.ts#L7
|
|
7
|
-
const expiryDays = {
|
|
8
|
-
'1-day': 1,
|
|
9
|
-
'3-days': 3,
|
|
10
|
-
'7-days': 7,
|
|
11
|
-
'30-days': 30,
|
|
12
|
-
};
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
13
5
|
const getEnabledLifeCycleRule = ({ key, value, }) => {
|
|
14
6
|
return {
|
|
15
7
|
Expiration: {
|
|
@@ -23,13 +15,11 @@ const getEnabledLifeCycleRule = ({ key, value, }) => {
|
|
|
23
15
|
};
|
|
24
16
|
};
|
|
25
17
|
const getLifeCycleRules = () => {
|
|
26
|
-
return Object.entries(expiryDays).map(([key, value]) => getEnabledLifeCycleRule({ key, value }));
|
|
18
|
+
return Object.entries(client_1.expiryDays).map(([key, value]) => getEnabledLifeCycleRule({ key, value }));
|
|
27
19
|
};
|
|
28
20
|
exports.getLifeCycleRules = getLifeCycleRules;
|
|
29
|
-
const generateRandomHashWithLifeCycleRule = (deleteAfter) => {
|
|
30
|
-
return [deleteAfter,
|
|
31
|
-
.filter(truthy_1.truthy)
|
|
32
|
-
.join('-');
|
|
21
|
+
const generateRandomHashWithLifeCycleRule = (deleteAfter, providerSpecifics) => {
|
|
22
|
+
return [deleteAfter, providerSpecifics.randomHash()].filter(client_1.truthy).join('-');
|
|
33
23
|
};
|
|
34
24
|
exports.generateRandomHashWithLifeCycleRule = generateRandomHashWithLifeCycleRule;
|
|
35
25
|
const validateDeleteAfter = (lifeCycleValue) => {
|
|
@@ -42,8 +32,8 @@ const validateDeleteAfter = (lifeCycleValue) => {
|
|
|
42
32
|
if (typeof lifeCycleValue !== 'string') {
|
|
43
33
|
throw new TypeError(`Expected life cycle value to be a string, got ${JSON.stringify(lifeCycleValue)}`);
|
|
44
34
|
}
|
|
45
|
-
if (!(lifeCycleValue in expiryDays)) {
|
|
46
|
-
throw new TypeError(`Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(', ')}, got ${lifeCycleValue}`);
|
|
35
|
+
if (!(lifeCycleValue in client_1.expiryDays)) {
|
|
36
|
+
throw new TypeError(`Expected deleteAfter value to be one of ${Object.keys(client_1.expiryDays).join(', ')}, got ${lifeCycleValue}`);
|
|
47
37
|
}
|
|
48
38
|
};
|
|
49
39
|
exports.validateDeleteAfter = validateDeleteAfter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeAwsArtifact = void 0;
|
|
4
|
+
const makeAwsArtifact = ({ region, renderBucketName, storageKey, artifact, }) => {
|
|
5
|
+
return {
|
|
6
|
+
filename: artifact.filename,
|
|
7
|
+
sizeInBytes: artifact.content.length,
|
|
8
|
+
s3Url: `https://s3.${region}.amazonaws.com/${renderBucketName}/${storageKey}`,
|
|
9
|
+
s3Key: storageKey,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeAwsArtifact = makeAwsArtifact;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare const makeTimeoutError: ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, }: {
|
|
1
|
+
import type { CloudProvider, EnhancedErrorInfo, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { RenderMetadata } from '@remotion/serverless/client';
|
|
3
|
+
export declare const makeTimeoutError: <Provider extends CloudProvider<string, Record<string, unknown>>>({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, providerSpecifics, }: {
|
|
4
4
|
timeoutInMilliseconds: number;
|
|
5
|
-
renderMetadata: RenderMetadata
|
|
5
|
+
renderMetadata: RenderMetadata<Provider>;
|
|
6
6
|
renderId: string;
|
|
7
7
|
missingChunks: number[];
|
|
8
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
8
9
|
}) => EnhancedErrorInfo;
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeTimeoutError = void 0;
|
|
4
4
|
const make_timeout_message_1 = require("./make-timeout-message");
|
|
5
|
-
const makeTimeoutError = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, }) => {
|
|
5
|
+
const makeTimeoutError = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, providerSpecifics, }) => {
|
|
6
6
|
const message = (0, make_timeout_message_1.makeTimeoutMessage)({
|
|
7
7
|
missingChunks,
|
|
8
8
|
renderMetadata,
|
|
9
9
|
timeoutInMilliseconds,
|
|
10
10
|
renderId,
|
|
11
|
+
providerSpecifics,
|
|
11
12
|
});
|
|
12
13
|
const error = new Error(message);
|
|
13
14
|
return {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { RenderMetadata } from '@remotion/serverless/client';
|
|
3
|
+
export declare const makeTimeoutMessage: <Provider extends CloudProvider<string, Record<string, unknown>>>({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, providerSpecifics, }: {
|
|
3
4
|
timeoutInMilliseconds: number;
|
|
4
5
|
missingChunks: number[];
|
|
5
|
-
renderMetadata: RenderMetadata
|
|
6
|
+
renderMetadata: RenderMetadata<Provider>;
|
|
6
7
|
renderId: string;
|
|
8
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
7
9
|
}) => string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeTimeoutMessage = void 0;
|
|
4
|
-
const
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
5
|
const docs_url_1 = require("../../shared/docs-url");
|
|
6
6
|
const get_aws_urls_1 = require("../../shared/get-aws-urls");
|
|
7
|
-
const get_current_region_1 = require("./get-current-region");
|
|
8
7
|
const MAX_MISSING_CHUNKS = 5;
|
|
9
|
-
const makeChunkMissingMessage = ({ missingChunks, renderMetadata, }) => {
|
|
8
|
+
const makeChunkMissingMessage = ({ missingChunks, renderMetadata, providerSpecifics, }) => {
|
|
10
9
|
if (missingChunks.length === 0) {
|
|
11
10
|
return 'All chunks have been successfully rendered, but the main function has timed out.';
|
|
12
11
|
}
|
|
@@ -26,7 +25,7 @@ const makeChunkMissingMessage = ({ missingChunks, renderMetadata, }) => {
|
|
|
26
25
|
msg,
|
|
27
26
|
`▸ Logs for chunk ${ch}: ${(0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
28
27
|
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
29
|
-
region:
|
|
28
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
30
29
|
rendererFunctionName: null,
|
|
31
30
|
renderId: renderMetadata.renderId,
|
|
32
31
|
chunk: ch,
|
|
@@ -36,24 +35,24 @@ const makeChunkMissingMessage = ({ missingChunks, renderMetadata, }) => {
|
|
|
36
35
|
.slice(0, 5),
|
|
37
36
|
].join('\n');
|
|
38
37
|
};
|
|
39
|
-
const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, }) => {
|
|
38
|
+
const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, providerSpecifics, }) => {
|
|
40
39
|
const cloudWatchRendererUrl = (0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
41
40
|
renderId,
|
|
42
41
|
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
43
|
-
region:
|
|
42
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
44
43
|
rendererFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
45
44
|
chunk: null,
|
|
46
45
|
});
|
|
47
46
|
const cloudWatchLaunchUrl = (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
48
47
|
renderId,
|
|
49
48
|
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
50
|
-
method:
|
|
51
|
-
region:
|
|
49
|
+
method: client_1.ServerlessRoutines.launch,
|
|
50
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
52
51
|
rendererFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
53
52
|
});
|
|
54
53
|
const message = [
|
|
55
54
|
`The main function timed out after ${timeoutInMilliseconds}ms.`,
|
|
56
|
-
makeChunkMissingMessage({ missingChunks, renderMetadata }),
|
|
55
|
+
makeChunkMissingMessage({ missingChunks, renderMetadata, providerSpecifics }),
|
|
57
56
|
'',
|
|
58
57
|
`Consider increasing the timeout of your function.`,
|
|
59
58
|
`▸ You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import type { AudioCodec, LogLevel } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { LambdaCodec } from '../../shared/validate-lambda-codec';
|
|
2
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
3
|
+
import type { CustomCredentials, DownloadBehavior, Privacy, RenderMetadata, SerializedInputProps, ServerlessCodec } from '@remotion/serverless/client';
|
|
4
|
+
import type { PostRenderData } from '../../shared/constants';
|
|
6
5
|
import type { OverallProgressHelper } from './overall-render-progress';
|
|
7
|
-
export declare const mergeChunksAndFinishRender: (options: {
|
|
6
|
+
export declare const mergeChunksAndFinishRender: <Provider extends CloudProvider<string, Record<string, unknown>>>(options: {
|
|
8
7
|
bucketName: string;
|
|
9
8
|
renderId: string;
|
|
10
9
|
expectedBucketOwner: string;
|
|
11
10
|
numberOfFrames: number;
|
|
12
|
-
codec:
|
|
11
|
+
codec: ServerlessCodec;
|
|
13
12
|
chunkCount: number;
|
|
14
13
|
fps: number;
|
|
15
14
|
numberOfGifLoops: number | null;
|
|
16
15
|
audioCodec: AudioCodec | null;
|
|
17
16
|
renderBucketName: string;
|
|
18
|
-
customCredentials: CustomCredentials | null;
|
|
17
|
+
customCredentials: CustomCredentials<Provider> | null;
|
|
19
18
|
downloadBehavior: DownloadBehavior;
|
|
20
19
|
key: string;
|
|
21
20
|
privacy: Privacy;
|
|
22
21
|
inputProps: SerializedInputProps;
|
|
23
22
|
serializedResolvedProps: SerializedInputProps;
|
|
24
|
-
renderMetadata: RenderMetadata
|
|
23
|
+
renderMetadata: RenderMetadata<Provider>;
|
|
25
24
|
audioBitrate: string | null;
|
|
26
25
|
logLevel: LogLevel;
|
|
27
26
|
framesPerLambda: number;
|
|
@@ -30,6 +29,7 @@ export declare const mergeChunksAndFinishRender: (options: {
|
|
|
30
29
|
compositionStart: number;
|
|
31
30
|
outdir: string;
|
|
32
31
|
files: string[];
|
|
33
|
-
overallProgress: OverallProgressHelper
|
|
32
|
+
overallProgress: OverallProgressHelper<Provider>;
|
|
34
33
|
startTime: number;
|
|
35
|
-
|
|
34
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
35
|
+
}) => Promise<PostRenderData<Provider>>;
|
|
@@ -8,10 +8,8 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const cleanup_props_1 = require("./cleanup-props");
|
|
9
9
|
const concat_videos_1 = require("./concat-videos");
|
|
10
10
|
const create_post_render_data_1 = require("./create-post-render-data");
|
|
11
|
-
const get_current_region_1 = require("./get-current-region");
|
|
12
11
|
const get_output_url_from_metadata_1 = require("./get-output-url-from-metadata");
|
|
13
12
|
const inspect_errors_1 = require("./inspect-errors");
|
|
14
|
-
const io_1 = require("./io");
|
|
15
13
|
const timer_1 = require("./timer");
|
|
16
14
|
const mergeChunksAndFinishRender = async (options) => {
|
|
17
15
|
const onProgress = (framesEncoded) => {
|
|
@@ -41,28 +39,29 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
41
39
|
const encodingStop = Date.now();
|
|
42
40
|
options.overallProgress.setTimeToCombine(encodingStop - encodingStart);
|
|
43
41
|
const outputSize = fs_1.default.statSync(outfile).size;
|
|
44
|
-
const
|
|
45
|
-
await
|
|
42
|
+
const writeToBucket = (0, timer_1.timer)(`Writing to bucket (${outputSize} bytes)`, options.logLevel);
|
|
43
|
+
await options.providerSpecifics.writeFile({
|
|
46
44
|
bucketName: options.renderBucketName,
|
|
47
45
|
key: options.key,
|
|
48
46
|
body: fs_1.default.createReadStream(outfile),
|
|
49
|
-
region:
|
|
47
|
+
region: options.providerSpecifics.getCurrentRegionInFunction(),
|
|
50
48
|
privacy: options.privacy,
|
|
51
49
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
52
50
|
downloadBehavior: options.downloadBehavior,
|
|
53
51
|
customCredentials: options.customCredentials,
|
|
54
52
|
});
|
|
55
|
-
|
|
53
|
+
writeToBucket.end();
|
|
56
54
|
const errorExplanations = (0, inspect_errors_1.inspectErrors)({
|
|
57
55
|
errors: options.overallProgress.get().errors,
|
|
58
56
|
});
|
|
59
57
|
const cleanupProm = (0, cleanup_props_1.cleanupProps)({
|
|
60
58
|
inputProps: options.inputProps,
|
|
61
59
|
serializedResolvedProps: options.serializedResolvedProps,
|
|
60
|
+
providerSpecifics: options.providerSpecifics,
|
|
62
61
|
});
|
|
63
|
-
const { url: outputUrl } = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(options.renderMetadata, options.bucketName, options.customCredentials);
|
|
62
|
+
const { url: outputUrl } = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(options.renderMetadata, options.bucketName, options.customCredentials, options.providerSpecifics.getCurrentRegionInFunction());
|
|
64
63
|
const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
|
|
65
|
-
region:
|
|
64
|
+
region: options.providerSpecifics.getCurrentRegionInFunction(),
|
|
66
65
|
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
67
66
|
renderMetadata: options.renderMetadata,
|
|
68
67
|
errorExplanations,
|