@remotion/lambda 4.0.163 → 4.0.165
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/delete-render.js +7 -3
- package/dist/api/deploy-function.d.ts +0 -1
- package/dist/api/deploy-function.js +3 -3
- package/dist/api/deploy-site.d.ts +3 -3
- package/dist/api/download-media.js +6 -3
- package/dist/api/get-compositions-on-lambda.js +0 -2
- package/dist/api/get-render-progress.js +0 -2
- package/dist/api/make-lambda-payload.js +2 -1
- package/dist/api/render-media-on-lambda.js +0 -2
- package/dist/api/render-still-on-lambda.js +37 -25
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/commands/functions/ls.js +3 -1
- package/dist/cli/commands/render/progress.d.ts +3 -28
- package/dist/cli/commands/render/progress.js +89 -90
- package/dist/cli/commands/render/render.js +7 -40
- package/dist/cli/commands/sites/create.js +2 -2
- package/dist/functions/chunk-optimization/types.d.ts +0 -3
- package/dist/functions/helpers/calculate-chunk-times.d.ts +3 -4
- package/dist/functions/helpers/calculate-chunk-times.js +4 -8
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +3 -5
- package/dist/functions/helpers/calculate-price-from-bucket.js +5 -18
- package/dist/functions/helpers/clean-tmpdir.d.ts +0 -2
- package/dist/functions/helpers/clean-tmpdir.js +1 -7
- package/dist/functions/helpers/concat-videos.d.ts +1 -13
- package/dist/functions/helpers/concat-videos.js +7 -131
- package/dist/functions/helpers/create-post-render-data.d.ts +6 -6
- package/dist/functions/helpers/create-post-render-data.js +17 -37
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -3
- package/dist/functions/helpers/find-output-file-in-bucket.js +1 -4
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-progress-step-size.js +0 -3
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -6
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -13
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +8 -0
- package/dist/functions/helpers/get-overall-progress-s3.js +25 -0
- package/dist/functions/helpers/get-overall-progress.d.ts +1 -2
- package/dist/functions/helpers/get-overall-progress.js +2 -4
- package/dist/functions/helpers/get-progress.js +78 -154
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
- package/dist/functions/helpers/get-retry-stats.js +0 -18
- package/dist/functions/helpers/inspect-errors.d.ts +4 -10
- package/dist/functions/helpers/inspect-errors.js +5 -27
- package/dist/functions/helpers/io.d.ts +0 -1
- package/dist/functions/helpers/io.js +2 -3
- package/dist/functions/helpers/lifecycle.d.ts +0 -4
- package/dist/functions/helpers/lifecycle.js +2 -3
- package/dist/functions/helpers/make-timeout-error.d.ts +0 -2
- package/dist/functions/helpers/merge-chunks.d.ts +5 -7
- package/dist/functions/helpers/merge-chunks.js +16 -149
- package/dist/functions/helpers/min-max.d.ts +1 -1
- package/dist/functions/helpers/min-max.js +1 -1
- package/dist/functions/helpers/overall-render-progress.d.ts +49 -0
- package/dist/functions/helpers/overall-render-progress.js +164 -0
- package/dist/functions/helpers/stream-renderer.d.ts +11 -0
- package/dist/functions/helpers/stream-renderer.js +127 -0
- package/dist/functions/helpers/streamify-response.d.ts +0 -3
- package/dist/functions/helpers/streamify-response.js +2 -14
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/helpers/write-lambda-error.d.ts +3 -6
- package/dist/functions/helpers/write-lambda-error.js +1 -21
- package/dist/functions/index.d.ts +5 -0
- package/dist/functions/index.js +70 -51
- package/dist/functions/launch.js +103 -200
- package/dist/functions/renderer.d.ts +2 -2
- package/dist/functions/renderer.js +70 -123
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +3 -2
- package/dist/functions/still.d.ts +7 -2
- package/dist/functions/still.js +17 -34
- package/dist/functions/streaming/stream-writer.d.ts +6 -0
- package/dist/functions/streaming/stream-writer.js +35 -0
- package/dist/functions/streaming/streaming.d.ts +92 -0
- package/dist/functions/streaming/streaming.js +58 -0
- package/dist/internals.d.ts +7 -6
- package/dist/shared/aws-clients.js +8 -0
- package/dist/shared/call-lambda.d.ts +5 -4
- package/dist/shared/call-lambda.js +53 -44
- package/dist/shared/constants.d.ts +15 -49
- package/dist/shared/constants.js +3 -32
- package/dist/shared/content-disposition-header.d.ts +0 -3
- package/dist/shared/get-function-version.js +0 -2
- package/dist/shared/is-flaky-error.js +4 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -2
- package/dist/shared/parse-lambda-timings-key.js +0 -14
- package/dist/shared/return-values.d.ts +0 -7
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
|
@@ -10,6 +10,7 @@ const client_sts_1 = require("@aws-sdk/client-sts");
|
|
|
10
10
|
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
11
11
|
const no_react_1 = require("remotion/no-react");
|
|
12
12
|
const check_credentials_1 = require("./check-credentials");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
13
14
|
const is_in_lambda_1 = require("./is-in-lambda");
|
|
14
15
|
const _clients = {};
|
|
15
16
|
const getCredentials = () => {
|
|
@@ -141,6 +142,13 @@ const getServiceClient = ({ region, service, customCredentials, }) => {
|
|
|
141
142
|
: new Client({
|
|
142
143
|
region,
|
|
143
144
|
credentials: getCredentials(),
|
|
145
|
+
requestHandler: service === 'lambda'
|
|
146
|
+
? {
|
|
147
|
+
httpsAgent: {
|
|
148
|
+
maxSockets: constants_1.MAX_FUNCTIONS_PER_RENDER + 50,
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
: undefined,
|
|
144
152
|
});
|
|
145
153
|
if (process.env.REMOTION_DISABLE_AWS_CLIENT_CACHE) {
|
|
146
154
|
return client;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OnMessage } from '../functions/streaming/streaming';
|
|
2
2
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
3
3
|
import type { LambdaPayloads, LambdaRoutines } from './constants';
|
|
4
4
|
import type { LambdaReturnValues } from './return-values';
|
|
@@ -7,10 +7,11 @@ type Options<T extends LambdaRoutines> = {
|
|
|
7
7
|
type: T;
|
|
8
8
|
payload: Omit<LambdaPayloads[T], 'type'>;
|
|
9
9
|
region: AwsRegion;
|
|
10
|
-
receivedStreamingPayload: (streamPayload: StreamingPayloads) => void;
|
|
11
10
|
timeoutInTest: number;
|
|
12
11
|
};
|
|
13
|
-
export declare const callLambda: <T extends LambdaRoutines>(options: Options<T>
|
|
12
|
+
export declare const callLambda: <T extends LambdaRoutines>(options: Options<T>) => Promise<LambdaReturnValues[T]>;
|
|
13
|
+
export declare const callLambdaWithStreaming: <T extends LambdaRoutines>(options: Options<T> & {
|
|
14
|
+
receivedStreamingPayload: OnMessage;
|
|
14
15
|
retriesRemaining: number;
|
|
15
|
-
}) => Promise<
|
|
16
|
+
}) => Promise<void>;
|
|
16
17
|
export {};
|
|
@@ -1,48 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.callLambda = void 0;
|
|
3
|
+
exports.callLambdaWithStreaming = exports.callLambda = void 0;
|
|
4
4
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
5
|
-
const
|
|
5
|
+
const pure_1 = require("@remotion/renderer/pure");
|
|
6
|
+
const streaming_1 = require("../functions/streaming/streaming");
|
|
6
7
|
const aws_clients_1 = require("./aws-clients");
|
|
7
8
|
const INVALID_JSON_MESSAGE = 'Cannot parse Lambda response as JSON';
|
|
8
|
-
const
|
|
9
|
+
const parseJsonOrThrowSource = (data, type) => {
|
|
10
|
+
const asString = new TextDecoder('utf-8').decode(data);
|
|
9
11
|
try {
|
|
10
|
-
return JSON.parse(
|
|
12
|
+
return JSON.parse(asString);
|
|
11
13
|
}
|
|
12
|
-
catch (
|
|
13
|
-
throw new Error(
|
|
14
|
+
catch (err) {
|
|
15
|
+
throw new Error(`Invalid JSON (${type}): ${asString}`);
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if ('
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if ('errorMessage' in json) {
|
|
23
|
-
const err = new Error(json.errorMessage);
|
|
24
|
-
err.name = json.errorType;
|
|
25
|
-
err.stack = ((_a = json.trace) !== null && _a !== void 0 ? _a : []).join('\n');
|
|
26
|
-
throw err;
|
|
27
|
-
}
|
|
28
|
-
// This will not happen, it is for narrowing purposes
|
|
29
|
-
if ('statusCode' in json) {
|
|
30
|
-
throw new Error(`Lambda function failed with status code ${json.statusCode}`);
|
|
31
|
-
}
|
|
32
|
-
if (json.type === 'error') {
|
|
33
|
-
const err = new Error(json.message);
|
|
34
|
-
err.stack = json.stack;
|
|
18
|
+
const callLambda = async (options) => {
|
|
19
|
+
// Do not remove this await
|
|
20
|
+
const res = await callLambdaWithoutRetry(options);
|
|
21
|
+
if (res.type === 'error') {
|
|
22
|
+
const err = new Error(res.message);
|
|
23
|
+
err.stack = res.stack;
|
|
35
24
|
throw err;
|
|
36
25
|
}
|
|
37
|
-
return
|
|
26
|
+
return res;
|
|
38
27
|
};
|
|
39
|
-
|
|
28
|
+
exports.callLambda = callLambda;
|
|
29
|
+
const callLambdaWithStreaming = async (options) => {
|
|
40
30
|
// As of August 2023, Lambda streaming sometimes misses parts of the JSON response.
|
|
41
31
|
// Handling this for now by applying a retry mechanism.
|
|
42
32
|
try {
|
|
43
33
|
// Do not remove this await
|
|
44
|
-
|
|
45
|
-
return res;
|
|
34
|
+
await callLambdaWithStreamingWithoutRetry(options);
|
|
46
35
|
}
|
|
47
36
|
catch (err) {
|
|
48
37
|
if (options.retriesRemaining === 0) {
|
|
@@ -51,33 +40,54 @@ const callLambda = async (options) => {
|
|
|
51
40
|
if (!err.message.includes(INVALID_JSON_MESSAGE)) {
|
|
52
41
|
throw err;
|
|
53
42
|
}
|
|
54
|
-
return (0, exports.
|
|
43
|
+
return (0, exports.callLambdaWithStreaming)({
|
|
55
44
|
...options,
|
|
56
45
|
retriesRemaining: options.retriesRemaining - 1,
|
|
57
46
|
});
|
|
58
47
|
}
|
|
59
48
|
};
|
|
60
|
-
exports.
|
|
61
|
-
const callLambdaWithoutRetry = async ({ functionName, type, payload, region,
|
|
49
|
+
exports.callLambdaWithStreaming = callLambdaWithStreaming;
|
|
50
|
+
const callLambdaWithoutRetry = async ({ functionName, type, payload, region, timeoutInTest, }) => {
|
|
51
|
+
const Payload = JSON.stringify({ type, ...payload });
|
|
52
|
+
const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest).send(new client_lambda_1.InvokeCommand({
|
|
53
|
+
FunctionName: functionName,
|
|
54
|
+
Payload,
|
|
55
|
+
InvocationType: 'RequestResponse',
|
|
56
|
+
}));
|
|
57
|
+
const decoded = new TextDecoder('utf-8').decode(res.Payload);
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse(decoded);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
throw new Error(`Invalid JSON (${type}): ${JSON.stringify(decoded)}`);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const callLambdaWithStreamingWithoutRetry = async ({ functionName, type, payload, region, timeoutInTest, receivedStreamingPayload, }) => {
|
|
62
66
|
const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
63
67
|
FunctionName: functionName,
|
|
64
68
|
Payload: JSON.stringify({ type, ...payload }),
|
|
65
69
|
}));
|
|
70
|
+
const { onData, clear } = pure_1.NoReactAPIs.makeStreamer((status, messageTypeId, data) => {
|
|
71
|
+
const messageType = (0, streaming_1.messageTypeIdToMessageType)(messageTypeId);
|
|
72
|
+
const innerPayload = streaming_1.formatMap[messageType] === 'json'
|
|
73
|
+
? parseJsonOrThrowSource(data, messageType)
|
|
74
|
+
: data;
|
|
75
|
+
const message = {
|
|
76
|
+
successType: status,
|
|
77
|
+
message: {
|
|
78
|
+
type: messageType,
|
|
79
|
+
payload: innerPayload,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
receivedStreamingPayload(message);
|
|
83
|
+
});
|
|
66
84
|
const events = res.EventStream;
|
|
67
|
-
let responsePayload = '';
|
|
68
85
|
for await (const event of events) {
|
|
69
86
|
// There are two types of events you can get on a stream.
|
|
70
87
|
// `PayloadChunk`: These contain the actual raw bytes of the chunk
|
|
71
88
|
// It has a single property: `Payload`
|
|
72
|
-
if (event.PayloadChunk) {
|
|
73
|
-
|
|
74
|
-
const decoded = new TextDecoder('utf-8').decode(event.PayloadChunk.Payload);
|
|
75
|
-
const streamPayload = (0, streaming_payloads_1.isStreamingPayload)(decoded);
|
|
76
|
-
if (streamPayload) {
|
|
77
|
-
receivedStreamingPayload(streamPayload);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
responsePayload += decoded;
|
|
89
|
+
if (event.PayloadChunk && event.PayloadChunk.Payload) {
|
|
90
|
+
onData(event.PayloadChunk.Payload);
|
|
81
91
|
}
|
|
82
92
|
if (event.InvokeComplete) {
|
|
83
93
|
if (event.InvokeComplete.ErrorCode) {
|
|
@@ -89,6 +99,5 @@ const callLambdaWithoutRetry = async ({ functionName, type, payload, region, rec
|
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
return json;
|
|
102
|
+
clear();
|
|
94
103
|
};
|
|
@@ -32,36 +32,7 @@ export declare const RENDER_FN_PREFIX = "remotion-render-";
|
|
|
32
32
|
export declare const LOG_GROUP_PREFIX = "/aws/lambda/";
|
|
33
33
|
export declare const LAMBDA_INSIGHTS_PREFIX = "/aws/lambda-insights";
|
|
34
34
|
export declare const rendersPrefix: (renderId: string) => string;
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const renderMetadataKey: (renderId: string) => string;
|
|
37
|
-
export declare const initalizedMetadataKey: (renderId: string) => string;
|
|
38
|
-
export declare const lambdaChunkInitializedPrefix: (renderId: string) => string;
|
|
39
|
-
export declare const lambdaChunkInitializedKey: ({ renderId, chunk, attempt, }: {
|
|
40
|
-
attempt: number;
|
|
41
|
-
renderId: string;
|
|
42
|
-
chunk: number;
|
|
43
|
-
}) => string;
|
|
44
|
-
export declare const lambdaTimingsPrefix: (renderId: string) => string;
|
|
45
|
-
export declare const lambdaTimingsPrefixForChunk: (renderId: string, chunk: number) => string;
|
|
46
|
-
export declare const lambdaLogsPrefix: (renderId: string, chunk: number, startFrame: number, endFrame: number) => string;
|
|
47
|
-
export declare const lambdaTimingsKey: ({ renderId, chunk, start, rendered, }: {
|
|
48
|
-
renderId: string;
|
|
49
|
-
chunk: number;
|
|
50
|
-
start: number;
|
|
51
|
-
rendered: number;
|
|
52
|
-
}) => string;
|
|
53
|
-
export declare const chunkKey: (renderId: string) => string;
|
|
54
|
-
export declare const chunkKeyForIndex: ({ renderId, index, type, }: {
|
|
55
|
-
renderId: string;
|
|
56
|
-
index: number;
|
|
57
|
-
type: 'video' | 'audio';
|
|
58
|
-
}) => string;
|
|
59
|
-
export declare const getErrorKeyPrefix: (renderId: string) => string;
|
|
60
|
-
export declare const getErrorFileName: ({ renderId, chunk, attempt, }: {
|
|
61
|
-
renderId: string;
|
|
62
|
-
chunk: number | null;
|
|
63
|
-
attempt: number;
|
|
64
|
-
}) => string;
|
|
35
|
+
export declare const overallProgressKey: (renderId: string) => string;
|
|
65
36
|
export type OutNameInput = string | {
|
|
66
37
|
bucketName: string;
|
|
67
38
|
key: string;
|
|
@@ -81,7 +52,6 @@ export declare const getSitesKey: (siteId: string) => string;
|
|
|
81
52
|
export declare const outName: (renderId: string, extension: string) => string;
|
|
82
53
|
export declare const outStillName: (renderId: string, imageFormat: StillImageFormat) => string;
|
|
83
54
|
export declare const customOutName: (renderId: string, bucketName: string, name: OutNameInput) => OutNameOutput;
|
|
84
|
-
export declare const postRenderDataKey: (renderId: string) => string;
|
|
85
55
|
export declare const defaultPropsKey: (hash: string) => string;
|
|
86
56
|
export declare const inputPropsKey: (hash: string) => string;
|
|
87
57
|
export declare const resolvedPropsKey: (hash: string) => string;
|
|
@@ -96,8 +66,7 @@ export declare enum LambdaRoutines {
|
|
|
96
66
|
status = "status",
|
|
97
67
|
renderer = "renderer",
|
|
98
68
|
still = "still",
|
|
99
|
-
compositions = "compositions"
|
|
100
|
-
merge = "merge"
|
|
69
|
+
compositions = "compositions"
|
|
101
70
|
}
|
|
102
71
|
type Prettify<T> = {
|
|
103
72
|
[K in keyof T]: T[K];
|
|
@@ -263,6 +232,7 @@ export type LambdaPayloads = {
|
|
|
263
232
|
colorSpace: ColorSpace | null;
|
|
264
233
|
compositionStart: number;
|
|
265
234
|
framesPerLambda: number;
|
|
235
|
+
progressEveryNthFrame: number;
|
|
266
236
|
};
|
|
267
237
|
still: {
|
|
268
238
|
type: LambdaRoutines.still;
|
|
@@ -288,6 +258,7 @@ export type LambdaPayloads = {
|
|
|
288
258
|
bucketName: string | null;
|
|
289
259
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
290
260
|
deleteAfter: DeleteAfter | null;
|
|
261
|
+
streamed: boolean;
|
|
291
262
|
};
|
|
292
263
|
compositions: {
|
|
293
264
|
type: LambdaRoutines.compositions;
|
|
@@ -301,23 +272,8 @@ export type LambdaPayloads = {
|
|
|
301
272
|
bucketName: string | null;
|
|
302
273
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
303
274
|
};
|
|
304
|
-
merge: {
|
|
305
|
-
type: LambdaRoutines.merge;
|
|
306
|
-
bucketName: string;
|
|
307
|
-
renderId: string;
|
|
308
|
-
outName: OutNameInput | null;
|
|
309
|
-
inputProps: SerializedInputProps;
|
|
310
|
-
serializedResolvedProps: SerializedInputProps;
|
|
311
|
-
logLevel: LogLevel;
|
|
312
|
-
framesPerLambda: number;
|
|
313
|
-
preferLossless: boolean;
|
|
314
|
-
compositionStart: number;
|
|
315
|
-
};
|
|
316
275
|
};
|
|
317
276
|
export type LambdaPayload = LambdaPayloads[LambdaRoutines];
|
|
318
|
-
export type EncodingProgress = {
|
|
319
|
-
framesEncoded: number;
|
|
320
|
-
};
|
|
321
277
|
type Discriminated = {
|
|
322
278
|
type: 'still';
|
|
323
279
|
imageFormat: StillImageFormat;
|
|
@@ -364,11 +320,11 @@ export type PostRenderData = {
|
|
|
364
320
|
outputSize: number;
|
|
365
321
|
renderSize: number;
|
|
366
322
|
timeToFinish: number;
|
|
323
|
+
timeToRenderFrames: number;
|
|
367
324
|
errors: EnhancedErrorInfo[];
|
|
368
325
|
startTime: number;
|
|
369
326
|
endTime: number;
|
|
370
327
|
filesCleanedUp: number;
|
|
371
|
-
renderMetadata: RenderMetadata;
|
|
372
328
|
timeToEncode: number;
|
|
373
329
|
timeToCleanUp: number;
|
|
374
330
|
timeToRenderChunks: number;
|
|
@@ -376,6 +332,7 @@ export type PostRenderData = {
|
|
|
376
332
|
mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
|
|
377
333
|
estimatedBillingDurationInMilliseconds: number;
|
|
378
334
|
deleteAfter: DeleteAfter | null;
|
|
335
|
+
timeToCombine: number | null;
|
|
379
336
|
};
|
|
380
337
|
export type CostsInfo = {
|
|
381
338
|
accruedSoFar: number;
|
|
@@ -388,6 +345,11 @@ export type CleanupInfo = {
|
|
|
388
345
|
minFilesToDelete: number;
|
|
389
346
|
filesDeleted: number;
|
|
390
347
|
};
|
|
348
|
+
type EncodingProgress = {
|
|
349
|
+
framesEncoded: number;
|
|
350
|
+
combinedFrames: number;
|
|
351
|
+
timeToCombine: number | null;
|
|
352
|
+
};
|
|
391
353
|
export type RenderProgress = {
|
|
392
354
|
chunks: number;
|
|
393
355
|
done: boolean;
|
|
@@ -407,6 +369,7 @@ export type RenderProgress = {
|
|
|
407
369
|
lambdasInvoked: number;
|
|
408
370
|
cleanup: CleanupInfo | null;
|
|
409
371
|
timeToFinishChunks: number | null;
|
|
372
|
+
timeToRenderFrames: number | null;
|
|
410
373
|
timeToEncode: number | null;
|
|
411
374
|
overallProgress: number;
|
|
412
375
|
retriesInfo: ChunkRetry[];
|
|
@@ -415,6 +378,9 @@ export type RenderProgress = {
|
|
|
415
378
|
outputSizeInBytes: number | null;
|
|
416
379
|
type: 'success';
|
|
417
380
|
estimatedBillingDurationInMilliseconds: number | null;
|
|
381
|
+
combinedFrames: number;
|
|
382
|
+
timeToCombine: number | null;
|
|
383
|
+
timeoutTimestamp: number;
|
|
418
384
|
};
|
|
419
385
|
export type Privacy = 'public' | 'private' | 'no-acl';
|
|
420
386
|
export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
|
package/dist/shared/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.defaultPropsKey = exports.
|
|
3
|
+
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.defaultPropsKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.overallProgressKey = exports.rendersPrefix = exports.LAMBDA_INSIGHTS_PREFIX = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
|
|
4
4
|
exports.MIN_MEMORY = 512;
|
|
5
5
|
exports.MAX_MEMORY = 10240;
|
|
6
6
|
exports.DEFAULT_MEMORY_SIZE = 2048;
|
|
@@ -25,32 +25,8 @@ exports.LOG_GROUP_PREFIX = '/aws/lambda/';
|
|
|
25
25
|
exports.LAMBDA_INSIGHTS_PREFIX = '/aws/lambda-insights';
|
|
26
26
|
const rendersPrefix = (renderId) => `renders/${renderId}`;
|
|
27
27
|
exports.rendersPrefix = rendersPrefix;
|
|
28
|
-
const
|
|
29
|
-
exports.
|
|
30
|
-
const renderMetadataKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/pre-render-metadata.json`;
|
|
31
|
-
exports.renderMetadataKey = renderMetadataKey;
|
|
32
|
-
const initalizedMetadataKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/initialized.txt`;
|
|
33
|
-
exports.initalizedMetadataKey = initalizedMetadataKey;
|
|
34
|
-
const lambdaChunkInitializedPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/lambda-initialized`;
|
|
35
|
-
exports.lambdaChunkInitializedPrefix = lambdaChunkInitializedPrefix;
|
|
36
|
-
const lambdaChunkInitializedKey = ({ renderId, chunk, attempt, }) => `${(0, exports.lambdaChunkInitializedPrefix)(renderId)}-chunk:${chunk}-attempt:${attempt}.txt`;
|
|
37
|
-
exports.lambdaChunkInitializedKey = lambdaChunkInitializedKey;
|
|
38
|
-
const lambdaTimingsPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/lambda-timings/chunk:`;
|
|
39
|
-
exports.lambdaTimingsPrefix = lambdaTimingsPrefix;
|
|
40
|
-
const lambdaTimingsPrefixForChunk = (renderId, chunk) => (0, exports.lambdaTimingsPrefix)(renderId) + String(chunk).padStart(8, '0');
|
|
41
|
-
exports.lambdaTimingsPrefixForChunk = lambdaTimingsPrefixForChunk;
|
|
42
|
-
const lambdaLogsPrefix = (renderId, chunk, startFrame, endFrame) => `${(0, exports.rendersPrefix)(renderId)}/logs/chunk:${String(chunk).padStart(8, '0')}:frames:${startFrame}-${endFrame}.json`;
|
|
43
|
-
exports.lambdaLogsPrefix = lambdaLogsPrefix;
|
|
44
|
-
const lambdaTimingsKey = ({ renderId, chunk, start, rendered, }) => `${(0, exports.lambdaTimingsPrefixForChunk)(renderId, chunk)}-start:${start}-rendered:${rendered}.txt`;
|
|
45
|
-
exports.lambdaTimingsKey = lambdaTimingsKey;
|
|
46
|
-
const chunkKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/chunks/chunk`;
|
|
47
|
-
exports.chunkKey = chunkKey;
|
|
48
|
-
const chunkKeyForIndex = ({ renderId, index, type, }) => `${(0, exports.chunkKey)(renderId)}:${String(index).padStart(8, '0')}:${type}`;
|
|
49
|
-
exports.chunkKeyForIndex = chunkKeyForIndex;
|
|
50
|
-
const getErrorKeyPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/errors/`;
|
|
51
|
-
exports.getErrorKeyPrefix = getErrorKeyPrefix;
|
|
52
|
-
const getErrorFileName = ({ renderId, chunk, attempt, }) => (0, exports.getErrorKeyPrefix)(renderId) + ':chunk-' + chunk + ':attempt-' + attempt;
|
|
53
|
-
exports.getErrorFileName = getErrorFileName;
|
|
28
|
+
const overallProgressKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/progress.json`;
|
|
29
|
+
exports.overallProgressKey = overallProgressKey;
|
|
54
30
|
const getSitesKey = (siteId) => `sites/${siteId}`;
|
|
55
31
|
exports.getSitesKey = getSitesKey;
|
|
56
32
|
const outName = (renderId, extension) => `${(0, exports.rendersPrefix)(renderId)}/out.${extension}`;
|
|
@@ -73,10 +49,6 @@ const customOutName = (renderId, bucketName, name) => {
|
|
|
73
49
|
};
|
|
74
50
|
};
|
|
75
51
|
exports.customOutName = customOutName;
|
|
76
|
-
const postRenderDataKey = (renderId) => {
|
|
77
|
-
return `${(0, exports.rendersPrefix)(renderId)}/post-render-metadata.json`;
|
|
78
|
-
};
|
|
79
|
-
exports.postRenderDataKey = postRenderDataKey;
|
|
80
52
|
const defaultPropsKey = (hash) => {
|
|
81
53
|
return `default-props/${hash}.json`;
|
|
82
54
|
};
|
|
@@ -102,6 +74,5 @@ var LambdaRoutines;
|
|
|
102
74
|
LambdaRoutines["renderer"] = "renderer";
|
|
103
75
|
LambdaRoutines["still"] = "still";
|
|
104
76
|
LambdaRoutines["compositions"] = "compositions";
|
|
105
|
-
LambdaRoutines["merge"] = "merge";
|
|
106
77
|
})(LambdaRoutines || (exports.LambdaRoutines = LambdaRoutines = {}));
|
|
107
78
|
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
|
|
@@ -12,9 +12,7 @@ const getFunctionVersion = async ({ functionName, region, logLevel, }) => {
|
|
|
12
12
|
},
|
|
13
13
|
region,
|
|
14
14
|
type: constants_1.LambdaRoutines.info,
|
|
15
|
-
receivedStreamingPayload: () => undefined,
|
|
16
15
|
timeoutInTest: 120000,
|
|
17
|
-
retriesRemaining: 0,
|
|
18
16
|
});
|
|
19
17
|
return result.version;
|
|
20
18
|
}
|
|
@@ -49,6 +49,10 @@ const isFlakyError = (err) => {
|
|
|
49
49
|
if (message.includes('Timeout exceeded rendering the component')) {
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
|
+
// CDN slowness
|
|
53
|
+
if (message.includes('Loading root component')) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
52
56
|
// Internet flakiness
|
|
53
57
|
if (message.includes('getaddrinfo') ||
|
|
54
58
|
message.includes('ECONNRESET') ||
|
|
@@ -1,16 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseLambdaTimingsKey = void 0;
|
|
4
|
-
const parseLambdaTimingsKey = (key) => {
|
|
5
|
-
const match = key.match(/^renders\/(.*)\/lambda-timings\/chunk:([0-9]+)-start:([0-9]+)-rendered:([0-9]+).txt$/);
|
|
6
|
-
if (!match) {
|
|
7
|
-
throw new Error(`Cannot parse filename ${key} into timing information. Malformed data.`);
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
renderId: match[1],
|
|
11
|
-
chunk: Number(match[2]),
|
|
12
|
-
start: Number(match[3]),
|
|
13
|
-
rendered: Number(match[4]),
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
exports.parseLambdaTimingsKey = parseLambdaTimingsKey;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import type { compositionsHandler } from '../functions/compositions';
|
|
2
2
|
import type { infoHandler } from '../functions/info';
|
|
3
3
|
import type { launchHandler } from '../functions/launch';
|
|
4
|
-
import type { mergeHandler } from '../functions/merge';
|
|
5
4
|
import type { progressHandler } from '../functions/progress';
|
|
6
5
|
import type { rendererHandler } from '../functions/renderer';
|
|
7
6
|
import type { startHandler } from '../functions/start';
|
|
8
7
|
import type { stillHandler } from '../functions/still';
|
|
9
8
|
import type { LambdaRoutines } from './constants';
|
|
10
|
-
export type OrError<T> = T | {
|
|
11
|
-
type: 'error';
|
|
12
|
-
message: string;
|
|
13
|
-
stack: string;
|
|
14
|
-
};
|
|
15
9
|
export interface LambdaReturnValues {
|
|
16
10
|
[LambdaRoutines.start]: ReturnType<typeof startHandler>;
|
|
17
11
|
[LambdaRoutines.launch]: ReturnType<typeof launchHandler>;
|
|
@@ -20,5 +14,4 @@ export interface LambdaReturnValues {
|
|
|
20
14
|
[LambdaRoutines.info]: ReturnType<typeof infoHandler>;
|
|
21
15
|
[LambdaRoutines.still]: ReturnType<typeof stillHandler>;
|
|
22
16
|
[LambdaRoutines.compositions]: ReturnType<typeof compositionsHandler>;
|
|
23
|
-
[LambdaRoutines.merge]: ReturnType<typeof mergeHandler>;
|
|
24
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.165",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"url": "https://github.com/JonnyBurger/remotion"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@smithy/abort-controller": "
|
|
17
|
-
"@aws-sdk/client-cloudwatch-logs": "3.
|
|
18
|
-
"@aws-sdk/client-iam": "3.
|
|
19
|
-
"@aws-sdk/client-lambda": "3.
|
|
20
|
-
"@aws-sdk/client-s3": "3.
|
|
21
|
-
"@aws-sdk/client-service-quotas": "3.
|
|
22
|
-
"@aws-sdk/client-sts": "3.
|
|
23
|
-
"@aws-sdk/credential-providers": "3.
|
|
24
|
-
"@aws-sdk/lib-storage": "3.
|
|
25
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
16
|
+
"@smithy/abort-controller": "3.0.0",
|
|
17
|
+
"@aws-sdk/client-cloudwatch-logs": "3.583.0",
|
|
18
|
+
"@aws-sdk/client-iam": "3.583.0",
|
|
19
|
+
"@aws-sdk/client-lambda": "3.583.0",
|
|
20
|
+
"@aws-sdk/client-s3": "3.583.0",
|
|
21
|
+
"@aws-sdk/client-service-quotas": "3.583.0",
|
|
22
|
+
"@aws-sdk/client-sts": "3.583.0",
|
|
23
|
+
"@aws-sdk/credential-providers": "3.583.0",
|
|
24
|
+
"@aws-sdk/lib-storage": "3.583.0",
|
|
25
|
+
"@aws-sdk/s3-request-presigner": "3.583.0",
|
|
26
26
|
"mime-types": "2.1.34",
|
|
27
27
|
"zod": "3.22.3",
|
|
28
|
-
"@remotion/bundler": "4.0.
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"remotion": "4.0.
|
|
28
|
+
"@remotion/bundler": "4.0.165",
|
|
29
|
+
"@remotion/cli": "4.0.165",
|
|
30
|
+
"@remotion/renderer": "4.0.165",
|
|
31
|
+
"remotion": "4.0.165"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jonny/eslint-config": "3.0.281",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"ts-node": "10.9.2",
|
|
45
45
|
"vitest": "0.31.1",
|
|
46
46
|
"zip-lib": "^0.7.2",
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
48
|
-
"@remotion/bundler": "4.0.
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.165",
|
|
48
|
+
"@remotion/bundler": "4.0.165"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.165"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|