@remotion/lambda 4.0.0-alpha.217 → 4.0.0-alpha10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/bundle-lambda.js +12 -12
- package/dist/admin/generate-etag-list.js +4 -4
- package/dist/admin/make-layer-public.js +4 -5
- package/dist/api/create-bucket.js +34 -1
- package/dist/api/create-function.js +4 -4
- package/dist/api/delete-function.d.ts +2 -2
- package/dist/api/delete-function.js +2 -2
- package/dist/api/delete-site.d.ts +4 -4
- package/dist/api/delete-site.js +4 -4
- package/dist/api/deploy-function.d.ts +8 -7
- package/dist/api/deploy-function.js +26 -25
- package/dist/api/deploy-site.d.ts +2 -1
- package/dist/api/deploy-site.js +7 -4
- package/dist/api/download-media.d.ts +1 -1
- package/dist/api/download-media.js +3 -3
- package/dist/api/get-compositions-on-lambda.d.ts +1 -1
- package/dist/api/get-functions.d.ts +3 -3
- package/dist/api/get-functions.js +7 -7
- package/dist/api/get-or-create-bucket.d.ts +2 -2
- package/dist/api/get-or-create-bucket.js +6 -6
- package/dist/api/get-render-progress.d.ts +1 -1
- package/dist/api/get-render-progress.js +5 -10
- package/dist/api/get-sites.d.ts +0 -1
- package/dist/api/iam-validation/user-permissions.js +2 -0
- package/dist/api/make-lambda-payload.d.ts +5 -0
- package/dist/api/make-lambda-payload.js +77 -0
- package/dist/api/render-media-on-lambda.d.ts +3 -3
- package/dist/api/render-media-on-lambda.js +4 -60
- package/dist/api/render-still-on-lambda.d.ts +1 -1
- package/dist/api/speculate-function-name.d.ts +3 -3
- package/dist/api/speculate-function-name.js +3 -3
- package/dist/api/upload-dir.js +7 -7
- package/dist/cli/commands/functions/deploy.js +6 -3
- package/dist/cli/commands/functions/ls.js +8 -3
- package/dist/cli/commands/functions/rm.js +12 -5
- package/dist/cli/commands/functions/rmall.js +12 -6
- package/dist/cli/commands/quotas/increase.js +2 -2
- package/dist/cli/commands/render/render.js +32 -14
- package/dist/cli/commands/sites/create.js +5 -1
- package/dist/cli/commands/sites/index.js +3 -0
- package/dist/cli/commands/still.js +24 -9
- package/dist/cli/help.js +4 -0
- package/dist/cli/index.js +3 -3
- package/dist/cli/log.d.ts +2 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/helpers/clean-tmpdir.js +7 -7
- package/dist/functions/helpers/concat-videos.js +7 -7
- package/dist/functions/helpers/get-browser-instance.js +1 -0
- package/dist/functions/helpers/get-chromium-executable-path.js +7 -6
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-files-in-folder.js +5 -5
- package/dist/functions/helpers/io.d.ts +8 -2
- package/dist/functions/helpers/io.js +22 -2
- package/dist/functions/helpers/streamify-response.d.ts +16 -0
- package/dist/functions/helpers/streamify-response.js +67 -0
- package/dist/functions/helpers/validate-composition.d.ts +4 -3
- package/dist/functions/helpers/validate-composition.js +9 -12
- package/dist/functions/index.d.ts +1 -18
- package/dist/functions/index.js +31 -10
- package/dist/functions/launch.js +12 -13
- package/dist/functions/renderer.js +6 -6
- package/dist/functions/still.js +8 -7
- package/dist/index.d.ts +1 -1
- package/dist/internals.d.ts +2 -0
- package/dist/internals.js +3 -0
- package/dist/shared/aws-clients.js +2 -2
- package/dist/shared/call-lambda.js +27 -2
- package/dist/shared/constants.d.ts +47 -45
- package/dist/shared/deserialize-input-props.d.ts +1 -1
- package/dist/shared/function-zip-path.js +2 -2
- package/dist/shared/get-etag.js +4 -4
- package/dist/shared/hosted-layers.js +35 -119
- package/dist/shared/invoke-webhook.d.ts +3 -1
- package/dist/shared/invoke-webhook.js +4 -4
- package/dist/shared/make-s3-key.js +2 -2
- package/dist/shared/make-s3-url.js +2 -2
- package/dist/shared/read-dir.js +2 -2
- package/dist/shared/return-values.d.ts +5 -0
- package/dist/shared/serialize-input-props.d.ts +1 -1
- package/dist/shared/serialize-input-props.js +1 -1
- package/dist/shared/validate-privacy.d.ts +1 -1
- package/dist/shared/validate-privacy.js +5 -2
- package/package.json +89 -90
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
- package/remotionlambda.zip +0 -0
package/dist/functions/launch.js
CHANGED
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.launchHandler = void 0;
|
|
27
27
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
28
28
|
const renderer_1 = require("@remotion/renderer");
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const node_fs_1 = __importStar(require("node:fs"));
|
|
30
|
+
const node_path_1 = require("node:path");
|
|
31
31
|
const remotion_1 = require("remotion");
|
|
32
32
|
const version_1 = require("remotion/version");
|
|
33
33
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
@@ -155,6 +155,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
155
155
|
downloadMap,
|
|
156
156
|
forceHeight: params.forceHeight,
|
|
157
157
|
forceWidth: params.forceWidth,
|
|
158
|
+
logLevel: params.logLevel,
|
|
158
159
|
});
|
|
159
160
|
remotion_1.Internals.validateDurationInFrames({
|
|
160
161
|
durationInFrames: comp.durationInFrames,
|
|
@@ -179,7 +180,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
179
180
|
throw new Error(`Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${constants_1.MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${docs_url_1.DOCS_URL}/docs/lambda/concurrency#too-many-functions for help.`);
|
|
180
181
|
}
|
|
181
182
|
(0, validate_outname_1.validateOutname)(params.outName, params.codec, params.audioCodec);
|
|
182
|
-
(0, validate_privacy_1.validatePrivacy)(params.privacy);
|
|
183
|
+
(0, validate_privacy_1.validatePrivacy)(params.privacy, true);
|
|
183
184
|
renderer_1.RenderInternals.validatePuppeteerTimeout(params.timeoutInMilliseconds);
|
|
184
185
|
const { chunks } = (0, plan_frame_ranges_1.planFrameRanges)({
|
|
185
186
|
framesPerLambda,
|
|
@@ -187,7 +188,6 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
187
188
|
everyNthFrame: params.everyNthFrame,
|
|
188
189
|
});
|
|
189
190
|
const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
|
|
190
|
-
const invokers = Math.round(Math.sqrt(chunks.length));
|
|
191
191
|
const reqSend = (0, timer_1.timer)('sending off requests');
|
|
192
192
|
const lambdaPayloads = chunks.map((chunkPayload) => {
|
|
193
193
|
var _a;
|
|
@@ -238,9 +238,8 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
238
238
|
estimatedTotalLambdaInvokations: [
|
|
239
239
|
// Direct invokations
|
|
240
240
|
chunks.length,
|
|
241
|
-
// Parent invokers
|
|
242
|
-
invokers,
|
|
243
241
|
// This function
|
|
242
|
+
1,
|
|
244
243
|
].reduce((a, b) => a + b, 0),
|
|
245
244
|
estimatedRenderLambdaInvokations: chunks.length,
|
|
246
245
|
compositionId: comp.id,
|
|
@@ -362,13 +361,13 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
362
361
|
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
363
362
|
};
|
|
364
363
|
const fps = comp.fps / params.everyNthFrame;
|
|
365
|
-
const outdir = (0,
|
|
366
|
-
if ((0,
|
|
367
|
-
(0,
|
|
364
|
+
const outdir = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
365
|
+
if ((0, node_fs_1.existsSync)(outdir)) {
|
|
366
|
+
(0, node_fs_1.rmSync)(outdir, {
|
|
368
367
|
recursive: true,
|
|
369
368
|
});
|
|
370
369
|
}
|
|
371
|
-
(0,
|
|
370
|
+
(0, node_fs_1.mkdirSync)(outdir);
|
|
372
371
|
const files = await (0, concat_videos_1.getAllFilesS3)({
|
|
373
372
|
bucket: params.bucketName,
|
|
374
373
|
expectedFiles: chunkCount,
|
|
@@ -390,11 +389,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
390
389
|
audioCodec: params.audioCodec,
|
|
391
390
|
});
|
|
392
391
|
const encodingStop = Date.now();
|
|
393
|
-
const outputSize =
|
|
392
|
+
const outputSize = node_fs_1.default.statSync(outfile);
|
|
394
393
|
await (0, io_1.lambdaWriteFile)({
|
|
395
394
|
bucketName: renderBucketName,
|
|
396
395
|
key,
|
|
397
|
-
body:
|
|
396
|
+
body: node_fs_1.default.createReadStream(outfile),
|
|
398
397
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
399
398
|
privacy: params.privacy,
|
|
400
399
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -473,7 +472,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
473
472
|
customCredentials: null,
|
|
474
473
|
});
|
|
475
474
|
renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
|
|
476
|
-
await Promise.all([cleanupChunksProm,
|
|
475
|
+
await Promise.all([cleanupChunksProm, node_fs_1.default.promises.rm(outfile)]);
|
|
477
476
|
clearTimeout(webhookDueToTimeout);
|
|
478
477
|
if (params.webhook && !webhookInvoked) {
|
|
479
478
|
try {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.rendererHandler = void 0;
|
|
7
7
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
13
13
|
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
@@ -51,7 +51,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
51
51
|
const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
|
|
52
52
|
? 'h264-mkv'
|
|
53
53
|
: params.codec;
|
|
54
|
-
const outputLocation =
|
|
54
|
+
const outputLocation = node_path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
|
|
55
55
|
codec: params.codec,
|
|
56
56
|
preferLossless: true,
|
|
57
57
|
}))}`);
|
|
@@ -178,7 +178,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
178
178
|
renderId: params.renderId,
|
|
179
179
|
index: params.chunk,
|
|
180
180
|
}),
|
|
181
|
-
body:
|
|
181
|
+
body: node_fs_1.default.createReadStream(outputLocation),
|
|
182
182
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
183
183
|
privacy: params.privacy,
|
|
184
184
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -186,8 +186,8 @@ const renderHandler = async (params, options, logs) => {
|
|
|
186
186
|
customCredentials: null,
|
|
187
187
|
});
|
|
188
188
|
await Promise.all([
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
node_fs_1.default.promises.rm(outputLocation, { recursive: true }),
|
|
190
|
+
node_fs_1.default.promises.rm(outputPath, { recursive: true }),
|
|
191
191
|
(0, io_1.lambdaWriteFile)({
|
|
192
192
|
bucketName: params.bucketName,
|
|
193
193
|
body: JSON.stringify(condensedTimingData, null, 2),
|
package/dist/functions/still.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.stillHandler = void 0;
|
|
7
7
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const estimate_price_1 = require("../api/estimate-price");
|
|
13
13
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
@@ -42,7 +42,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
42
42
|
throw new Error(`Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
43
43
|
}
|
|
44
44
|
(0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
|
|
45
|
-
(0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
|
|
45
|
+
(0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy, true);
|
|
46
46
|
(0, validate_outname_1.validateOutname)(lambdaParams.outName, null, null);
|
|
47
47
|
const start = Date.now();
|
|
48
48
|
const [bucketName, browserInstance] = await Promise.all([
|
|
@@ -52,7 +52,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
52
52
|
(0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
|
|
53
53
|
]);
|
|
54
54
|
const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
55
|
-
const outputPath =
|
|
55
|
+
const outputPath = node_path_1.default.join(outputDir, 'output');
|
|
56
56
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
57
57
|
const region = (0, get_current_region_1.getCurrentRegionInFunction)();
|
|
58
58
|
const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
|
|
@@ -78,6 +78,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
78
78
|
downloadMap,
|
|
79
79
|
forceHeight: lambdaParams.forceHeight,
|
|
80
80
|
forceWidth: lambdaParams.forceWidth,
|
|
81
|
+
logLevel: lambdaParams.logLevel,
|
|
81
82
|
});
|
|
82
83
|
const renderMetadata = {
|
|
83
84
|
startedDate: Date.now(),
|
|
@@ -134,19 +135,19 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
134
135
|
browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
|
|
135
136
|
});
|
|
136
137
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
|
|
137
|
-
const { size } = await
|
|
138
|
+
const { size } = await node_fs_1.default.promises.stat(outputPath);
|
|
138
139
|
await (0, io_1.lambdaWriteFile)({
|
|
139
140
|
bucketName: renderBucketName,
|
|
140
141
|
key,
|
|
141
142
|
privacy: lambdaParams.privacy,
|
|
142
|
-
body:
|
|
143
|
+
body: node_fs_1.default.createReadStream(outputPath),
|
|
143
144
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
144
145
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
145
146
|
downloadBehavior: lambdaParams.downloadBehavior,
|
|
146
147
|
customCredentials,
|
|
147
148
|
});
|
|
148
149
|
await Promise.all([
|
|
149
|
-
|
|
150
|
+
node_fs_1.default.promises.rm(outputPath, { recursive: true }),
|
|
150
151
|
(0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
|
|
151
152
|
bucketName,
|
|
152
153
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ import type { WebhookPayload } from './shared/invoke-webhook';
|
|
|
43
43
|
/**
|
|
44
44
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
45
45
|
*/
|
|
46
|
-
declare const renderMediaOnLambda: (
|
|
46
|
+
declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
47
47
|
/**
|
|
48
48
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
49
49
|
*/
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const LambdaInternals: {
|
|
2
2
|
executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
|
|
3
|
+
makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: import(".").RenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
|
|
4
|
+
getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: import(".").GetRenderInput) => import("./defaults").LambdaStatusPayload;
|
|
3
5
|
};
|
package/dist/internals.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LambdaInternals = void 0;
|
|
4
|
+
const make_lambda_payload_1 = require("./api/make-lambda-payload");
|
|
4
5
|
const index_1 = require("./cli/index");
|
|
5
6
|
exports.LambdaInternals = {
|
|
6
7
|
executeCommand: index_1.executeCommand,
|
|
8
|
+
makeLambdaRenderMediaPayload: make_lambda_payload_1.makeLambdaRenderMediaPayload,
|
|
9
|
+
getRenderProgressPayload: make_lambda_payload_1.getRenderProgressPayload,
|
|
7
10
|
};
|
|
@@ -8,7 +8,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
|
|
|
8
8
|
const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
|
|
9
9
|
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
10
10
|
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
11
|
-
const
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
12
|
const check_credentials_1 = require("./check-credentials");
|
|
13
13
|
const is_in_lambda_1 = require("./is-in-lambda");
|
|
14
14
|
const _clients = {};
|
|
@@ -90,7 +90,7 @@ const getCredentialsHash = ({ customCredentials, region, service, }) => {
|
|
|
90
90
|
hashComponents.customCredentials = customCredentials;
|
|
91
91
|
hashComponents.region = region;
|
|
92
92
|
hashComponents.service = service;
|
|
93
|
-
return (0,
|
|
93
|
+
return (0, node_crypto_1.createHash)('sha256')
|
|
94
94
|
.update(JSON.stringify(hashComponents))
|
|
95
95
|
.digest('base64');
|
|
96
96
|
};
|
|
@@ -5,12 +5,29 @@ const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
|
5
5
|
const aws_clients_1 = require("./aws-clients");
|
|
6
6
|
const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
7
7
|
var _a;
|
|
8
|
-
const res = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.
|
|
8
|
+
const res = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
9
9
|
FunctionName: functionName,
|
|
10
10
|
// @ts-expect-error
|
|
11
11
|
Payload: JSON.stringify({ type, ...payload }),
|
|
12
12
|
}));
|
|
13
|
-
const
|
|
13
|
+
const events = res.EventStream;
|
|
14
|
+
let responsePayload = new Uint8Array();
|
|
15
|
+
for await (const event of events) {
|
|
16
|
+
// There are two types of events you can get on a stream.
|
|
17
|
+
// `PayloadChunk`: These contain the actual raw bytes of the chunk
|
|
18
|
+
// It has a single property: `Payload`
|
|
19
|
+
if (event.PayloadChunk) {
|
|
20
|
+
// Decode the raw bytes into a string a human can read
|
|
21
|
+
const decoded = new TextDecoder('utf-8').decode(event.PayloadChunk.Payload);
|
|
22
|
+
responsePayload = Buffer.concat([responsePayload, Buffer.from(decoded)]);
|
|
23
|
+
}
|
|
24
|
+
if (event.InvokeComplete) {
|
|
25
|
+
if (event.InvokeComplete.ErrorCode) {
|
|
26
|
+
throw new Error(`Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const string = Buffer.from(responsePayload).toString();
|
|
14
31
|
const json = JSON.parse(string);
|
|
15
32
|
if ('errorMessage' in json) {
|
|
16
33
|
const err = new Error(json.errorMessage);
|
|
@@ -18,6 +35,14 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
|
18
35
|
err.stack = ((_a = json.trace) !== null && _a !== void 0 ? _a : []).join('\n');
|
|
19
36
|
throw err;
|
|
20
37
|
}
|
|
38
|
+
// Streaming: 3.3.96+
|
|
39
|
+
if ('statusCode' in json) {
|
|
40
|
+
if (json.statusCode !== 200) {
|
|
41
|
+
throw new Error(`Lambda function ${functionName} failed with status code ${json.statusCode}: ${json.body}`);
|
|
42
|
+
}
|
|
43
|
+
return JSON.parse(json.body);
|
|
44
|
+
}
|
|
45
|
+
// Non-streaming: 3.3.95 and below
|
|
21
46
|
return json;
|
|
22
47
|
};
|
|
23
48
|
exports.callLambda = callLambda;
|
|
@@ -104,48 +104,56 @@ export declare type SerializedInputProps = {
|
|
|
104
104
|
type: 'payload';
|
|
105
105
|
payload: unknown;
|
|
106
106
|
};
|
|
107
|
+
export declare type LambdaStartPayload = {
|
|
108
|
+
rendererFunctionName: string | null;
|
|
109
|
+
type: LambdaRoutines.start;
|
|
110
|
+
serveUrl: string;
|
|
111
|
+
composition: string;
|
|
112
|
+
framesPerLambda: number | null;
|
|
113
|
+
inputProps: SerializedInputProps;
|
|
114
|
+
codec: LambdaCodec;
|
|
115
|
+
audioCodec: AudioCodec | null;
|
|
116
|
+
imageFormat: VideoImageFormat;
|
|
117
|
+
crf: number | undefined;
|
|
118
|
+
envVariables: Record<string, string> | undefined;
|
|
119
|
+
pixelFormat: PixelFormat | undefined;
|
|
120
|
+
proResProfile: ProResProfile | undefined;
|
|
121
|
+
jpegQuality: number | undefined;
|
|
122
|
+
maxRetries: number;
|
|
123
|
+
privacy: Privacy;
|
|
124
|
+
logLevel: LogLevel;
|
|
125
|
+
frameRange: FrameRange | null;
|
|
126
|
+
outName: OutNameInput | null;
|
|
127
|
+
timeoutInMilliseconds: number;
|
|
128
|
+
chromiumOptions: ChromiumOptions;
|
|
129
|
+
scale: number;
|
|
130
|
+
everyNthFrame: number;
|
|
131
|
+
numberOfGifLoops: number | null;
|
|
132
|
+
concurrencyPerLambda: number;
|
|
133
|
+
downloadBehavior: DownloadBehavior;
|
|
134
|
+
muted: boolean;
|
|
135
|
+
version: string;
|
|
136
|
+
overwrite: boolean;
|
|
137
|
+
audioBitrate: string | null;
|
|
138
|
+
videoBitrate: string | null;
|
|
139
|
+
webhook: WebhookOption;
|
|
140
|
+
forceHeight: number | null;
|
|
141
|
+
forceWidth: number | null;
|
|
142
|
+
bucketName: string | null;
|
|
143
|
+
dumpBrowserLogs: boolean;
|
|
144
|
+
};
|
|
145
|
+
export declare type LambdaStatusPayload = {
|
|
146
|
+
type: LambdaRoutines.status;
|
|
147
|
+
bucketName: string;
|
|
148
|
+
renderId: string;
|
|
149
|
+
version: string;
|
|
150
|
+
s3OutputProvider?: CustomCredentials;
|
|
151
|
+
};
|
|
107
152
|
export declare type LambdaPayloads = {
|
|
108
153
|
info: {
|
|
109
154
|
type: LambdaRoutines.info;
|
|
110
155
|
};
|
|
111
|
-
start:
|
|
112
|
-
rendererFunctionName: string | null;
|
|
113
|
-
type: LambdaRoutines.start;
|
|
114
|
-
serveUrl: string;
|
|
115
|
-
composition: string;
|
|
116
|
-
framesPerLambda: number | null;
|
|
117
|
-
inputProps: SerializedInputProps;
|
|
118
|
-
codec: LambdaCodec;
|
|
119
|
-
audioCodec: AudioCodec | null;
|
|
120
|
-
imageFormat: VideoImageFormat;
|
|
121
|
-
crf: number | undefined;
|
|
122
|
-
envVariables: Record<string, string> | undefined;
|
|
123
|
-
pixelFormat: PixelFormat | undefined;
|
|
124
|
-
proResProfile: ProResProfile | undefined;
|
|
125
|
-
jpegQuality: number | undefined;
|
|
126
|
-
maxRetries: number;
|
|
127
|
-
privacy: Privacy;
|
|
128
|
-
logLevel: LogLevel;
|
|
129
|
-
frameRange: FrameRange | null;
|
|
130
|
-
outName: OutNameInput | null;
|
|
131
|
-
timeoutInMilliseconds: number;
|
|
132
|
-
chromiumOptions: ChromiumOptions;
|
|
133
|
-
scale: number;
|
|
134
|
-
everyNthFrame: number;
|
|
135
|
-
numberOfGifLoops: number | null;
|
|
136
|
-
concurrencyPerLambda: number;
|
|
137
|
-
downloadBehavior: DownloadBehavior;
|
|
138
|
-
muted: boolean;
|
|
139
|
-
version: string;
|
|
140
|
-
overwrite: boolean;
|
|
141
|
-
audioBitrate: string | null;
|
|
142
|
-
videoBitrate: string | null;
|
|
143
|
-
webhook: WebhookOption;
|
|
144
|
-
forceHeight: number | null;
|
|
145
|
-
forceWidth: number | null;
|
|
146
|
-
bucketName: string | null;
|
|
147
|
-
dumpBrowserLogs: boolean;
|
|
148
|
-
};
|
|
156
|
+
start: LambdaStartPayload;
|
|
149
157
|
launch: {
|
|
150
158
|
rendererFunctionName: string | null;
|
|
151
159
|
type: LambdaRoutines.launch;
|
|
@@ -184,13 +192,7 @@ export declare type LambdaPayloads = {
|
|
|
184
192
|
forceWidth: number | null;
|
|
185
193
|
dumpBrowserLogs: boolean;
|
|
186
194
|
};
|
|
187
|
-
status:
|
|
188
|
-
type: LambdaRoutines.status;
|
|
189
|
-
bucketName: string;
|
|
190
|
-
renderId: string;
|
|
191
|
-
version: string;
|
|
192
|
-
s3OutputProvider?: CustomCredentials;
|
|
193
|
-
};
|
|
195
|
+
status: LambdaStatusPayload;
|
|
194
196
|
renderer: {
|
|
195
197
|
concurrencyPerLambda: number;
|
|
196
198
|
type: LambdaRoutines.renderer;
|
|
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FUNCTION_ZIP_ARM64 = void 0;
|
|
7
|
-
const
|
|
8
|
-
exports.FUNCTION_ZIP_ARM64 =
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
exports.FUNCTION_ZIP_ARM64 = node_path_1.default.join(node_path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
|
package/dist/shared/get-etag.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getEtagOfFile = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const chunk = 1024 * 1024 * 5; // 5MB
|
|
10
|
-
const md5 = (data) =>
|
|
10
|
+
const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
11
11
|
const getEtagOfFile = async (filePath) => {
|
|
12
|
-
const stream = await
|
|
12
|
+
const stream = await node_fs_1.default.promises.readFile(filePath);
|
|
13
13
|
if (stream.length <= chunk) {
|
|
14
14
|
return `"${md5(stream)}"`;
|
|
15
15
|
}
|