@remotion/lambda 4.1.0-alpha11 → 4.1.0-alpha12
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/get-compositions-on-lambda.js +1 -0
- package/dist/api/get-render-progress.js +1 -0
- package/dist/api/render-media-on-lambda.js +1 -0
- package/dist/api/render-still-on-lambda.js +1 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/helpers/io.js +5 -1
- package/dist/functions/helpers/on-downloads-logger.d.ts +2 -0
- package/dist/functions/helpers/on-downloads-logger.js +28 -0
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/index.js +21 -14
- package/dist/functions/launch.js +10 -1
- package/dist/functions/renderer.js +5 -29
- package/dist/functions/still.js +5 -3
- package/dist/shared/call-lambda.d.ts +6 -2
- package/dist/shared/call-lambda.js +37 -8
- package/dist/shared/cleanup-serialized-input-props.d.ts +5 -0
- package/dist/shared/cleanup-serialized-input-props.js +15 -1
- package/dist/shared/get-function-version.js +1 -0
- package/dist/shared/invoke-webhook.d.ts +0 -2
- package/dist/shared/is-flaky-error.d.ts +1 -0
- package/dist/shared/is-flaky-error.js +31 -0
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
|
@@ -82,12 +82,16 @@ const lambdaWriteFile = async (params) => {
|
|
|
82
82
|
if (remainingRetries === 0) {
|
|
83
83
|
throw err;
|
|
84
84
|
}
|
|
85
|
+
const backoff = 2 ** (2 - remainingRetries) * 2000;
|
|
86
|
+
await new Promise((resolve) => {
|
|
87
|
+
setTimeout(resolve, backoff);
|
|
88
|
+
});
|
|
85
89
|
console.warn('Failed to write file to Lambda:');
|
|
86
90
|
console.warn(err);
|
|
87
91
|
console.warn(`Retrying (${remainingRetries} retries remaining)...`);
|
|
88
92
|
return (0, exports.lambdaWriteFile)({
|
|
89
93
|
...params,
|
|
90
|
-
retries:
|
|
94
|
+
retries: remainingRetries - 1,
|
|
91
95
|
});
|
|
92
96
|
}
|
|
93
97
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onDownloadsHelper = void 0;
|
|
4
|
+
const onDownloadsHelper = () => {
|
|
5
|
+
const downloads = {};
|
|
6
|
+
return (src) => {
|
|
7
|
+
console.log('Downloading', src);
|
|
8
|
+
downloads[src] = 0;
|
|
9
|
+
return ({ percent, downloaded }) => {
|
|
10
|
+
if (percent === null) {
|
|
11
|
+
console.log(`Download progress (${src}): ${downloaded} bytes. Don't know final size of download, no Content-Length header.`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (
|
|
15
|
+
// Only report every 10% change
|
|
16
|
+
downloads[src] > percent - 0.1 &&
|
|
17
|
+
percent !== 1) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
downloads[src] = percent;
|
|
21
|
+
console.log(`Download progress (${src}): ${downloaded} bytes, ${(percent * 100).toFixed(1)}%`);
|
|
22
|
+
if (percent === 1) {
|
|
23
|
+
console.log(`Download complete: ${src}`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.onDownloadsHelper = onDownloadsHelper;
|
|
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
4
4
|
type: z.ZodLiteral<"render-id-determined">;
|
|
5
5
|
renderId: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
type: "render-id-determined";
|
|
8
7
|
renderId: string;
|
|
9
|
-
}, {
|
|
10
8
|
type: "render-id-determined";
|
|
9
|
+
}, {
|
|
11
10
|
renderId: string;
|
|
11
|
+
type: "render-id-determined";
|
|
12
12
|
}>]>;
|
|
13
13
|
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
14
|
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
-
type: "render-id-determined";
|
|
16
15
|
renderId: string;
|
|
16
|
+
type: "render-id-determined";
|
|
17
17
|
};
|
|
18
18
|
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
19
|
export {};
|
package/dist/functions/index.js
CHANGED
|
@@ -44,8 +44,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
44
44
|
params,
|
|
45
45
|
renderId,
|
|
46
46
|
});
|
|
47
|
-
responseStream.write(JSON.stringify(response))
|
|
48
|
-
|
|
47
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
48
|
+
responseStream.end();
|
|
49
|
+
});
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
if (params.type === constants_1.LambdaRoutines.start) {
|
|
@@ -57,8 +58,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
57
58
|
const response = await (0, start_1.startHandler)(params, {
|
|
58
59
|
expectedBucketOwner: currentUserId,
|
|
59
60
|
});
|
|
60
|
-
responseStream.write(JSON.stringify(response))
|
|
61
|
-
|
|
61
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
62
|
+
responseStream.end();
|
|
63
|
+
});
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
64
66
|
if (params.type === constants_1.LambdaRoutines.launch) {
|
|
@@ -72,8 +74,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
72
74
|
expectedBucketOwner: currentUserId,
|
|
73
75
|
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
74
76
|
});
|
|
75
|
-
responseStream.write(JSON.stringify(response))
|
|
76
|
-
|
|
77
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
78
|
+
responseStream.end();
|
|
79
|
+
});
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
if (params.type === constants_1.LambdaRoutines.status) {
|
|
@@ -85,8 +88,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
85
88
|
expectedBucketOwner: currentUserId,
|
|
86
89
|
timeoutInMilliseconds,
|
|
87
90
|
});
|
|
88
|
-
responseStream.write(JSON.stringify(response))
|
|
89
|
-
|
|
91
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
92
|
+
responseStream.end();
|
|
93
|
+
});
|
|
90
94
|
return;
|
|
91
95
|
}
|
|
92
96
|
if (params.type === constants_1.LambdaRoutines.renderer) {
|
|
@@ -102,8 +106,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
102
106
|
expectedBucketOwner: currentUserId,
|
|
103
107
|
isWarm,
|
|
104
108
|
});
|
|
105
|
-
responseStream.write(JSON.stringify(response))
|
|
106
|
-
|
|
109
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
110
|
+
responseStream.end();
|
|
111
|
+
});
|
|
107
112
|
return;
|
|
108
113
|
}
|
|
109
114
|
if (params.type === constants_1.LambdaRoutines.info) {
|
|
@@ -111,8 +116,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
111
116
|
isWarm,
|
|
112
117
|
});
|
|
113
118
|
const response = await (0, info_1.infoHandler)(params);
|
|
114
|
-
responseStream.write(JSON.stringify(response))
|
|
115
|
-
|
|
119
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
120
|
+
responseStream.end();
|
|
121
|
+
});
|
|
116
122
|
return;
|
|
117
123
|
}
|
|
118
124
|
if (params.type === constants_1.LambdaRoutines.compositions) {
|
|
@@ -122,8 +128,9 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
122
128
|
const response = await (0, compositions_1.compositionsHandler)(params, {
|
|
123
129
|
expectedBucketOwner: currentUserId,
|
|
124
130
|
});
|
|
125
|
-
responseStream.write(JSON.stringify(response))
|
|
126
|
-
|
|
131
|
+
responseStream.write(JSON.stringify(response), () => {
|
|
132
|
+
responseStream.end();
|
|
133
|
+
});
|
|
127
134
|
return;
|
|
128
135
|
}
|
|
129
136
|
throw new Error(constants_1.COMMAND_NOT_FOUND);
|
package/dist/functions/launch.js
CHANGED
|
@@ -462,6 +462,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
462
462
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
463
463
|
serialized: params.inputProps,
|
|
464
464
|
});
|
|
465
|
+
const cleanupResolvedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedResolvedProps)({
|
|
466
|
+
bucketName: params.bucketName,
|
|
467
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
468
|
+
serialized: serializedResolvedProps,
|
|
469
|
+
});
|
|
465
470
|
const outputUrl = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, params.bucketName, customCredentials);
|
|
466
471
|
const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
|
|
467
472
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -472,7 +477,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
472
477
|
contents,
|
|
473
478
|
errorExplanations: await errorExplanationsProm,
|
|
474
479
|
timeToEncode: encodingStop - encodingStart,
|
|
475
|
-
timeToDelete: (await Promise.all([
|
|
480
|
+
timeToDelete: (await Promise.all([
|
|
481
|
+
deletProm,
|
|
482
|
+
cleanupSerializedInputPropsProm,
|
|
483
|
+
cleanupResolvedInputPropsProm,
|
|
484
|
+
])).reduce((a, b) => a + b, 0),
|
|
476
485
|
outputFile: {
|
|
477
486
|
lastModified: Date.now(),
|
|
478
487
|
size: outputSize.size,
|
|
@@ -12,10 +12,12 @@ const call_lambda_1 = require("../shared/call-lambda");
|
|
|
12
12
|
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
13
13
|
const compress_props_1 = require("../shared/compress-props");
|
|
14
14
|
const constants_1 = require("../shared/constants");
|
|
15
|
+
const is_flaky_error_1 = require("../shared/is-flaky-error");
|
|
15
16
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
16
17
|
const get_chromium_executable_path_1 = require("./helpers/get-chromium-executable-path");
|
|
17
18
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
18
19
|
const io_1 = require("./helpers/io");
|
|
20
|
+
const on_downloads_logger_1 = require("./helpers/on-downloads-logger");
|
|
19
21
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
20
22
|
const renderHandler = async (params, options, logs) => {
|
|
21
23
|
var _a;
|
|
@@ -63,7 +65,6 @@ const renderHandler = async (params, options, logs) => {
|
|
|
63
65
|
codec: params.codec,
|
|
64
66
|
preferLossless: true,
|
|
65
67
|
}))}`);
|
|
66
|
-
const downloads = {};
|
|
67
68
|
const resolvedProps = await resolvedPropsPromise;
|
|
68
69
|
const serializedInputPropsWithCustomSchema = await inputPropsPromise;
|
|
69
70
|
await new Promise((resolve, reject) => {
|
|
@@ -127,27 +128,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
127
128
|
crf: (_c = params.crf) !== null && _c !== void 0 ? _c : null,
|
|
128
129
|
pixelFormat: (_d = params.pixelFormat) !== null && _d !== void 0 ? _d : renderer_1.RenderInternals.DEFAULT_PIXEL_FORMAT,
|
|
129
130
|
proResProfile: params.proResProfile,
|
|
130
|
-
onDownload: (
|
|
131
|
-
console.log('Downloading', src);
|
|
132
|
-
downloads[src] = 0;
|
|
133
|
-
return ({ percent, downloaded }) => {
|
|
134
|
-
if (percent === null) {
|
|
135
|
-
console.log(`Download progress (${src}): ${downloaded} bytes. Don't know final size of download, no Content-Length header.`);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (
|
|
139
|
-
// Only report every 10% change
|
|
140
|
-
downloads[src] > percent - 0.1 &&
|
|
141
|
-
percent !== 1) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
downloads[src] = percent;
|
|
145
|
-
console.log(`Download progress (${src}): ${downloaded} bytes, ${(percent * 100).toFixed(1)}%`);
|
|
146
|
-
if (percent === 1) {
|
|
147
|
-
console.log(`Download complete: ${src}`);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
},
|
|
131
|
+
onDownload: (0, on_downloads_logger_1.onDownloadsHelper)(),
|
|
151
132
|
overwrite: false,
|
|
152
133
|
chromiumOptions: params.chromiumOptions,
|
|
153
134
|
scale: params.scale,
|
|
@@ -243,15 +224,9 @@ const rendererHandler = async (params, options) => {
|
|
|
243
224
|
console.log({ err });
|
|
244
225
|
throw err;
|
|
245
226
|
}
|
|
246
|
-
const { message } = err;
|
|
247
227
|
// If this error is encountered, we can just retry as it
|
|
248
228
|
// is a very rare error to occur
|
|
249
|
-
const isRetryableError =
|
|
250
|
-
message.includes('error while loading shared libraries: libnss3.so') ||
|
|
251
|
-
message.includes('but the server sent no data') ||
|
|
252
|
-
message.includes('Compositor panicked') ||
|
|
253
|
-
(message.includes('Compositor exited') && !message.includes('SIGSEGV')) ||
|
|
254
|
-
message.includes('Timed out while setting up the headless browser');
|
|
229
|
+
const isRetryableError = (0, is_flaky_error_1.isFlakyError)(err);
|
|
255
230
|
const shouldNotRetry = err.name === 'CancelledError';
|
|
256
231
|
const isFatal = !isRetryableError;
|
|
257
232
|
const willRetry = isRetryableError && params.retriesLeft > 0 && !shouldNotRetry;
|
|
@@ -288,6 +263,7 @@ const rendererHandler = async (params, options) => {
|
|
|
288
263
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
289
264
|
receivedStreamingPayload: () => undefined,
|
|
290
265
|
timeoutInTest: 120000,
|
|
266
|
+
retriesRemaining: 0,
|
|
291
267
|
});
|
|
292
268
|
return res;
|
|
293
269
|
}
|
package/dist/functions/still.js
CHANGED
|
@@ -16,6 +16,7 @@ const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-i
|
|
|
16
16
|
const compress_props_1 = require("../shared/compress-props");
|
|
17
17
|
const constants_1 = require("../shared/constants");
|
|
18
18
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
19
|
+
const is_flaky_error_1 = require("../shared/is-flaky-error");
|
|
19
20
|
const make_s3_url_1 = require("../shared/make-s3-url");
|
|
20
21
|
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
21
22
|
const validate_outname_1 = require("../shared/validate-outname");
|
|
@@ -27,6 +28,7 @@ const get_chromium_executable_path_1 = require("./helpers/get-chromium-executabl
|
|
|
27
28
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
28
29
|
const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-metadata");
|
|
29
30
|
const io_1 = require("./helpers/io");
|
|
31
|
+
const on_downloads_logger_1 = require("./helpers/on-downloads-logger");
|
|
30
32
|
const validate_composition_1 = require("./helpers/validate-composition");
|
|
31
33
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
32
34
|
const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, renderId, }) => {
|
|
@@ -141,7 +143,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
|
|
|
141
143
|
cancelSignal: null,
|
|
142
144
|
indent: false,
|
|
143
145
|
onBrowserLog: null,
|
|
144
|
-
onDownload:
|
|
146
|
+
onDownload: (0, on_downloads_logger_1.onDownloadsHelper)(),
|
|
145
147
|
port: null,
|
|
146
148
|
server,
|
|
147
149
|
logLevel: lambdaParams.logLevel,
|
|
@@ -202,8 +204,7 @@ const stillHandler = async (options) => {
|
|
|
202
204
|
catch (err) {
|
|
203
205
|
// If this error is encountered, we can just retry as it
|
|
204
206
|
// is a very rare error to occur
|
|
205
|
-
const isBrowserError =
|
|
206
|
-
err.message.includes('error while loading shared libraries: libnss3.so');
|
|
207
|
+
const isBrowserError = (0, is_flaky_error_1.isFlakyError)(err);
|
|
207
208
|
const willRetry = isBrowserError || params.maxRetries > 0;
|
|
208
209
|
if (!willRetry) {
|
|
209
210
|
throw err;
|
|
@@ -220,6 +221,7 @@ const stillHandler = async (options) => {
|
|
|
220
221
|
type: constants_1.LambdaRoutines.still,
|
|
221
222
|
receivedStreamingPayload: () => undefined,
|
|
222
223
|
timeoutInTest: 120000,
|
|
224
|
+
retriesRemaining: 0,
|
|
223
225
|
});
|
|
224
226
|
const bucketName = (_a = params.bucketName) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
225
227
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
@@ -2,11 +2,15 @@ import type { StreamingPayloads } from '../functions/helpers/streaming-payloads'
|
|
|
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';
|
|
5
|
-
|
|
5
|
+
type Options<T extends LambdaRoutines> = {
|
|
6
6
|
functionName: string;
|
|
7
7
|
type: T;
|
|
8
|
-
payload: Omit<LambdaPayloads[T],
|
|
8
|
+
payload: Omit<LambdaPayloads[T], 'type'>;
|
|
9
9
|
region: AwsRegion;
|
|
10
10
|
receivedStreamingPayload: (streamPayload: StreamingPayloads) => void;
|
|
11
11
|
timeoutInTest: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const callLambda: <T extends LambdaRoutines>(options: Options<T> & {
|
|
14
|
+
retriesRemaining: number;
|
|
12
15
|
}) => Promise<LambdaReturnValues[T]>;
|
|
16
|
+
export {};
|
|
@@ -4,13 +4,36 @@ exports.callLambda = void 0;
|
|
|
4
4
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
5
5
|
const streaming_payloads_1 = require("../functions/helpers/streaming-payloads");
|
|
6
6
|
const aws_clients_1 = require("./aws-clients");
|
|
7
|
-
const
|
|
7
|
+
const INVALID_JSON_MESSAGE = 'Cannot parse Lambda response as JSON';
|
|
8
|
+
const callLambda = async (options) => {
|
|
9
|
+
// As of August 2023, Lambda streaming sometimes misses parts of the JSON response.
|
|
10
|
+
// Handling this for now by applying a retry mechanism.
|
|
11
|
+
try {
|
|
12
|
+
// Do not remove this await
|
|
13
|
+
const res = await callLambdaWithoutRetry(options);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
if (options.retriesRemaining === 0) {
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
if (!err.message.includes(INVALID_JSON_MESSAGE)) {
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
return (0, exports.callLambda)({
|
|
24
|
+
...options,
|
|
25
|
+
retriesRemaining: options.retriesRemaining - 1,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.callLambda = callLambda;
|
|
30
|
+
const callLambdaWithoutRetry = async ({ functionName, type, payload, region, receivedStreamingPayload, timeoutInTest, }) => {
|
|
8
31
|
const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
9
32
|
FunctionName: functionName,
|
|
10
33
|
Payload: JSON.stringify({ type, ...payload }),
|
|
11
34
|
}));
|
|
12
35
|
const events = res.EventStream;
|
|
13
|
-
let responsePayload =
|
|
36
|
+
let responsePayload = '';
|
|
14
37
|
for await (const event of events) {
|
|
15
38
|
// There are two types of events you can get on a stream.
|
|
16
39
|
// `PayloadChunk`: These contain the actual raw bytes of the chunk
|
|
@@ -23,7 +46,7 @@ const callLambda = async ({ functionName, type, payload, region, receivedStreami
|
|
|
23
46
|
receivedStreamingPayload(streamPayload);
|
|
24
47
|
continue;
|
|
25
48
|
}
|
|
26
|
-
responsePayload
|
|
49
|
+
responsePayload += decoded;
|
|
27
50
|
}
|
|
28
51
|
if (event.InvokeComplete) {
|
|
29
52
|
if (event.InvokeComplete.ErrorCode) {
|
|
@@ -35,16 +58,22 @@ const callLambda = async ({ functionName, type, payload, region, receivedStreami
|
|
|
35
58
|
}
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
|
-
const
|
|
39
|
-
const json = parseJson(string);
|
|
61
|
+
const json = parseJson(responsePayload.trim());
|
|
40
62
|
return json;
|
|
41
63
|
};
|
|
42
|
-
|
|
64
|
+
const parseJsonWithErrorSurfacing = (input) => {
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(input);
|
|
67
|
+
}
|
|
68
|
+
catch (_a) {
|
|
69
|
+
throw new Error(`${INVALID_JSON_MESSAGE}. Response: ${input}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
43
72
|
const parseJson = (input) => {
|
|
44
73
|
var _a;
|
|
45
|
-
let json =
|
|
74
|
+
let json = parseJsonWithErrorSurfacing(input);
|
|
46
75
|
if ('statusCode' in json) {
|
|
47
|
-
json =
|
|
76
|
+
json = parseJsonWithErrorSurfacing(json.body);
|
|
48
77
|
}
|
|
49
78
|
if ('errorMessage' in json) {
|
|
50
79
|
const err = new Error(json.errorMessage);
|
|
@@ -5,3 +5,8 @@ export declare const cleanupSerializedInputProps: ({ serialized, region, bucketN
|
|
|
5
5
|
region: AwsRegion;
|
|
6
6
|
bucketName: string;
|
|
7
7
|
}) => Promise<number>;
|
|
8
|
+
export declare const cleanupSerializedResolvedProps: ({ serialized, region, bucketName, }: {
|
|
9
|
+
serialized: SerializedInputProps;
|
|
10
|
+
region: AwsRegion;
|
|
11
|
+
bucketName: string;
|
|
12
|
+
}) => Promise<number>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cleanupSerializedInputProps = void 0;
|
|
3
|
+
exports.cleanupSerializedResolvedProps = exports.cleanupSerializedInputProps = void 0;
|
|
4
4
|
const io_1 = require("../functions/helpers/io");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
|
|
@@ -17,3 +17,17 @@ const cleanupSerializedInputProps = async ({ serialized, region, bucketName, })
|
|
|
17
17
|
return Date.now() - time;
|
|
18
18
|
};
|
|
19
19
|
exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
|
|
20
|
+
const cleanupSerializedResolvedProps = async ({ serialized, region, bucketName, }) => {
|
|
21
|
+
if (serialized.type === 'payload') {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const time = Date.now();
|
|
25
|
+
await (0, io_1.lambdaDeleteFile)({
|
|
26
|
+
bucketName,
|
|
27
|
+
key: (0, constants_1.resolvedPropsKey)(serialized.hash),
|
|
28
|
+
region,
|
|
29
|
+
customCredentials: null,
|
|
30
|
+
});
|
|
31
|
+
return Date.now() - time;
|
|
32
|
+
};
|
|
33
|
+
exports.cleanupSerializedResolvedProps = cleanupSerializedResolvedProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFlakyError: (err: Error) => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFlakyError = void 0;
|
|
4
|
+
const isFlakyError = (err) => {
|
|
5
|
+
const { message } = err;
|
|
6
|
+
// storage.googleapis.com sometimes returns 500s, and Video does not have retry on its own
|
|
7
|
+
if ((message.includes('Format error') || message.includes('audio metadata')) &&
|
|
8
|
+
message.includes('storage.googleapis.com')) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (message.includes('FATAL:zygote_communication_linux.cc')) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (message.includes('error while loading shared libraries: libnss3.so')) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (message.includes('but the server sent no data')) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (message.includes('Compositor panicked')) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (message.includes('Compositor exited') && !message.includes('SIGSEGV')) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (message.includes('Timed out while setting up the headless browser')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
exports.isFlakyError = isFlakyError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-alpha12",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,23 +13,23 @@
|
|
|
13
13
|
"url": "https://github.com/JonnyBurger/remotion"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aws-sdk/abort-controller": "3.
|
|
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
|
+
"@aws-sdk/abort-controller": "3.374.0",
|
|
17
|
+
"@aws-sdk/client-cloudwatch-logs": "3.382.0",
|
|
18
|
+
"@aws-sdk/client-iam": "3.382.0",
|
|
19
|
+
"@aws-sdk/client-lambda": "3.382.0",
|
|
20
|
+
"@aws-sdk/client-s3": "3.382.0",
|
|
21
|
+
"@aws-sdk/client-service-quotas": "3.382.0",
|
|
22
|
+
"@aws-sdk/client-sts": "3.382.0",
|
|
23
|
+
"@aws-sdk/credential-providers": "3.382.0",
|
|
24
|
+
"@aws-sdk/lib-storage": "3.382.0",
|
|
25
|
+
"@aws-sdk/s3-request-presigner": "3.382.0",
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.21.4",
|
|
29
|
-
"@remotion/bundler": "4.1.0-
|
|
30
|
-
"@remotion/renderer": "4.1.0-
|
|
31
|
-
"remotion": "4.1.0-
|
|
32
|
-
"@remotion/cli": "4.1.0-
|
|
29
|
+
"@remotion/bundler": "4.1.0-alpha12",
|
|
30
|
+
"@remotion/renderer": "4.1.0-alpha12",
|
|
31
|
+
"remotion": "4.1.0-alpha12",
|
|
32
|
+
"@remotion/cli": "4.1.0-alpha12"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"typescript": "4.9.5",
|
|
45
45
|
"vitest": "0.31.1",
|
|
46
46
|
"zip-lib": "^0.7.2",
|
|
47
|
-
"@remotion/
|
|
48
|
-
"@remotion/
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.1.0-alpha12",
|
|
48
|
+
"@remotion/bundler": "4.1.0-alpha12"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@remotion/bundler": "4.1.0-
|
|
51
|
+
"@remotion/bundler": "4.1.0-alpha12"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|