@remotion/lambda 4.0.5 → 4.0.6
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 +2 -0
- package/dist/api/get-compositions-on-lambda.js +2 -0
- package/dist/api/get-render-progress.d.ts +2 -2
- package/dist/api/get-render-progress.js +2 -0
- package/dist/api/make-lambda-payload.d.ts +2 -2
- package/dist/api/render-media-on-lambda.js +2 -0
- package/dist/api/render-still-on-lambda.d.ts +5 -1
- package/dist/api/render-still-on-lambda.js +17 -2
- package/dist/cli/commands/render/render.js +1 -1
- package/dist/cli/commands/still.js +38 -50
- package/dist/cli/index.js +16 -2
- package/dist/cli/log.d.ts +6 -0
- package/dist/client.d.ts +4 -1
- package/dist/functions/compositions.d.ts +1 -0
- package/dist/functions/compositions.js +2 -1
- package/dist/functions/helpers/get-progress.js +2 -0
- package/dist/functions/helpers/streamify-response.js +15 -12
- package/dist/functions/helpers/streaming-payloads.d.ts +19 -0
- package/dist/functions/helpers/streaming-payloads.js +25 -0
- package/dist/functions/index.js +33 -5
- package/dist/functions/info.d.ts +1 -0
- package/dist/functions/info.js +1 -0
- package/dist/functions/launch.d.ts +3 -1
- package/dist/functions/launch.js +14 -9
- package/dist/functions/renderer.d.ts +3 -1
- package/dist/functions/renderer.js +16 -9
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +10 -8
- package/dist/functions/still.d.ts +8 -5
- package/dist/functions/still.js +51 -54
- package/dist/index.d.ts +3 -3
- package/dist/internals.d.ts +1 -1
- package/dist/shared/aws-clients.d.ts +1 -1
- package/dist/shared/aws-clients.js +3 -1
- package/dist/shared/call-lambda.d.ts +4 -1
- package/dist/shared/call-lambda.js +26 -12
- package/dist/shared/compress-props.js +1 -1
- package/dist/shared/constants.d.ts +1 -0
- package/dist/shared/get-function-version.js +2 -0
- package/dist/shared/return-values.d.ts +5 -5
- package/package.json +10 -9
- package/remotionlambda-arm64.zip +0 -0
|
@@ -33,11 +33,13 @@ const bundleLambda = async () => {
|
|
|
33
33
|
'./ffmpeg/remotion/bin/ffprobe.exe',
|
|
34
34
|
'./ffmpeg/remotion/bin/ffmpeg',
|
|
35
35
|
'./ffmpeg/remotion/bin/ffmpeg.exe',
|
|
36
|
+
'./mappings.wasm',
|
|
36
37
|
],
|
|
37
38
|
});
|
|
38
39
|
const compositorFile = `${outdir}/compositor`;
|
|
39
40
|
node_fs_1.default.copyFileSync(compositor_linux_arm64_gnu_1.binaryPath, compositorFile);
|
|
40
41
|
node_fs_1.default.cpSync(compositor_linux_arm64_gnu_1.ffmpegCwd, `${outdir}/ffmpeg`, { recursive: true });
|
|
42
|
+
node_fs_1.default.cpSync(node_path_1.default.join(__dirname, '..', '..', '..', 'renderer', 'node_modules', 'source-map', 'lib', 'mappings.wasm'), `${outdir}/mappings.wasm`);
|
|
41
43
|
await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
|
|
42
44
|
node_fs_1.default.rmSync(outdir, { recursive: true });
|
|
43
45
|
};
|
|
@@ -43,6 +43,8 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
|
|
|
43
43
|
bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
|
|
44
44
|
},
|
|
45
45
|
region,
|
|
46
|
+
receivedStreamingPayload: () => undefined,
|
|
47
|
+
timeoutInTest: 120000,
|
|
46
48
|
});
|
|
47
49
|
return res.compositions;
|
|
48
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
2
|
import type { CustomCredentials } from '../shared/aws-clients';
|
|
3
3
|
import type { RenderProgress } from '../shared/constants';
|
|
4
|
-
export type
|
|
4
|
+
export type GetRenderProgressInput = {
|
|
5
5
|
functionName: string;
|
|
6
6
|
bucketName: string;
|
|
7
7
|
renderId: string;
|
|
@@ -18,4 +18,4 @@ export type GetRenderInput = {
|
|
|
18
18
|
* @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
|
|
19
19
|
* @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
|
|
20
20
|
*/
|
|
21
|
-
export declare const getRenderProgress: (input:
|
|
21
|
+
export declare const getRenderProgress: (input: GetRenderProgressInput) => Promise<RenderProgress>;
|
|
@@ -20,6 +20,8 @@ const getRenderProgress = async (input) => {
|
|
|
20
20
|
type: constants_1.LambdaRoutines.status,
|
|
21
21
|
payload: (0, make_lambda_payload_1.getRenderProgressPayload)(input),
|
|
22
22
|
region: input.region,
|
|
23
|
+
receivedStreamingPayload: () => undefined,
|
|
24
|
+
timeoutInTest: 120000,
|
|
23
25
|
});
|
|
24
26
|
return result;
|
|
25
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LambdaStartPayload, LambdaStatusPayload } from '../defaults';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GetRenderProgressInput } from './get-render-progress';
|
|
3
3
|
import type { RenderMediaOnLambdaInput } from './render-media-on-lambda';
|
|
4
4
|
export declare const 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, }: RenderMediaOnLambdaInput) => Promise<LambdaStartPayload>;
|
|
5
|
-
export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }:
|
|
5
|
+
export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: GetRenderProgressInput) => LambdaStatusPayload;
|
|
@@ -33,6 +33,8 @@ const renderMediaOnLambda = async (input) => {
|
|
|
33
33
|
type: constants_1.LambdaRoutines.start,
|
|
34
34
|
payload: await (0, make_lambda_payload_1.makeLambdaRenderMediaPayload)(input),
|
|
35
35
|
region,
|
|
36
|
+
receivedStreamingPayload: () => undefined,
|
|
37
|
+
timeoutInTest: 120000,
|
|
36
38
|
});
|
|
37
39
|
return {
|
|
38
40
|
renderId: res.renderId,
|
|
@@ -31,6 +31,10 @@ export type RenderStillOnLambdaInput = {
|
|
|
31
31
|
* @deprecated Renamed to `dumpBrowserLogs`
|
|
32
32
|
*/
|
|
33
33
|
dumpBrowserLogs?: boolean;
|
|
34
|
+
onInit?: (data: {
|
|
35
|
+
renderId: string;
|
|
36
|
+
cloudWatchLogs: string;
|
|
37
|
+
}) => void;
|
|
34
38
|
};
|
|
35
39
|
export type RenderStillOnLambdaOutput = {
|
|
36
40
|
estimatedPrice: CostsInfo;
|
|
@@ -56,4 +60,4 @@ export type RenderStillOnLambdaOutput = {
|
|
|
56
60
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
57
61
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
58
62
|
*/
|
|
59
|
-
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
63
|
+
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, onInit, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.renderStillOnLambda = void 0;
|
|
4
4
|
const version_1 = require("remotion/version");
|
|
5
5
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
6
|
+
const compress_props_1 = require("../shared/compress-props");
|
|
6
7
|
const constants_1 = require("../shared/constants");
|
|
7
8
|
const get_aws_urls_1 = require("../shared/get-aws-urls");
|
|
8
|
-
const compress_props_1 = require("../shared/compress-props");
|
|
9
9
|
/**
|
|
10
10
|
* @description Renders a still frame on Lambda
|
|
11
11
|
* @link https://remotion.dev/docs/lambda/renderstillonlambda
|
|
@@ -22,7 +22,7 @@ const compress_props_1 = require("../shared/compress-props");
|
|
|
22
22
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
23
23
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
24
24
|
*/
|
|
25
|
-
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, }) => {
|
|
25
|
+
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, onInit, }) => {
|
|
26
26
|
var _a;
|
|
27
27
|
if (quality) {
|
|
28
28
|
throw new Error('The `quality` option is deprecated. Use `jpegQuality` instead.');
|
|
@@ -62,6 +62,21 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
62
62
|
bucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
|
|
63
63
|
},
|
|
64
64
|
region,
|
|
65
|
+
receivedStreamingPayload: (payload) => {
|
|
66
|
+
if (payload.type === 'render-id-determined') {
|
|
67
|
+
onInit === null || onInit === void 0 ? void 0 : onInit({
|
|
68
|
+
renderId: payload.renderId,
|
|
69
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchStreamUrl)({
|
|
70
|
+
functionName,
|
|
71
|
+
method: constants_1.LambdaRoutines.still,
|
|
72
|
+
region,
|
|
73
|
+
rendererFunctionName: null,
|
|
74
|
+
renderId: payload.renderId,
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
timeoutInTest: 120000,
|
|
65
80
|
});
|
|
66
81
|
return {
|
|
67
82
|
estimatedPrice: res.estimatedPrice,
|
|
@@ -4,6 +4,7 @@ exports.renderCommand = exports.RENDER_COMMAND = void 0;
|
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const config_1 = require("@remotion/cli/config");
|
|
6
6
|
const renderer_1 = require("@remotion/renderer");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
7
8
|
const download_media_1 = require("../../../api/download-media");
|
|
8
9
|
const get_render_progress_1 = require("../../../api/get-render-progress");
|
|
9
10
|
const render_media_on_lambda_1 = require("../../../api/render-media-on-lambda");
|
|
@@ -19,7 +20,6 @@ const find_function_name_1 = require("../../helpers/find-function-name");
|
|
|
19
20
|
const quit_1 = require("../../helpers/quit");
|
|
20
21
|
const log_1 = require("../../log");
|
|
21
22
|
const progress_1 = require("./progress");
|
|
22
|
-
const remotion_1 = require("remotion");
|
|
23
23
|
exports.RENDER_COMMAND = 'render';
|
|
24
24
|
const renderCommand = async (args, remotionRoot) => {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -4,6 +4,7 @@ exports.stillCommand = exports.STILL_COMMAND = void 0;
|
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const config_1 = require("@remotion/cli/config");
|
|
6
6
|
const renderer_1 = require("@remotion/renderer");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
7
8
|
const download_media_1 = require("../../api/download-media");
|
|
8
9
|
const render_still_on_lambda_1 = require("../../api/render-still-on-lambda");
|
|
9
10
|
const constants_1 = require("../../shared/constants");
|
|
@@ -15,10 +16,9 @@ const get_aws_region_1 = require("../get-aws-region");
|
|
|
15
16
|
const find_function_name_1 = require("../helpers/find-function-name");
|
|
16
17
|
const quit_1 = require("../helpers/quit");
|
|
17
18
|
const log_1 = require("../log");
|
|
18
|
-
const remotion_1 = require("remotion");
|
|
19
19
|
exports.STILL_COMMAND = 'still';
|
|
20
20
|
const stillCommand = async (args, remotionRoot) => {
|
|
21
|
-
var _a, _b, _c, _d, _e
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
22
|
const serveUrl = args[0];
|
|
23
23
|
if (!serveUrl) {
|
|
24
24
|
log_1.Log.error('No serve URL passed.');
|
|
@@ -83,57 +83,45 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
83
83
|
fromUi: null,
|
|
84
84
|
configImageFormat: (_e = config_1.ConfigInternals.getUserPreferredStillImageFormat()) !== null && _e !== void 0 ? _e : null,
|
|
85
85
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`functionName = ${functionName}, imageFormat = ${imageFormat} (${imageFormatReason})`));
|
|
87
|
+
const res = await (0, render_still_on_lambda_1.renderStillOnLambda)({
|
|
88
|
+
functionName,
|
|
89
|
+
serveUrl,
|
|
90
|
+
inputProps,
|
|
91
|
+
imageFormat,
|
|
92
|
+
composition,
|
|
93
|
+
privacy,
|
|
94
|
+
region,
|
|
95
|
+
maxRetries,
|
|
96
|
+
envVariables,
|
|
97
|
+
frame: stillFrame,
|
|
98
|
+
jpegQuality,
|
|
99
|
+
logLevel,
|
|
100
|
+
outName,
|
|
101
|
+
chromiumOptions,
|
|
102
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
103
|
+
scale,
|
|
104
|
+
forceHeight: height,
|
|
105
|
+
forceWidth: width,
|
|
106
|
+
onInit: ({ cloudWatchLogs, renderId }) => {
|
|
107
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Render invoked with ID = ${renderId}`));
|
|
108
|
+
log_1.Log.verbose(`CloudWatch logs (if enabled): ${cloudWatchLogs}`);
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
if (downloadName) {
|
|
112
|
+
log_1.Log.info('Finished rendering. Downloading...');
|
|
113
|
+
const { outputPath, sizeInBytes } = await (0, download_media_1.downloadMedia)({
|
|
114
|
+
bucketName: res.bucketName,
|
|
115
|
+
outPath: downloadName,
|
|
95
116
|
region,
|
|
96
|
-
|
|
97
|
-
envVariables,
|
|
98
|
-
frame: stillFrame,
|
|
99
|
-
jpegQuality,
|
|
100
|
-
logLevel,
|
|
101
|
-
outName,
|
|
102
|
-
chromiumOptions,
|
|
103
|
-
timeoutInMilliseconds: puppeteerTimeout,
|
|
104
|
-
scale,
|
|
105
|
-
forceHeight: height,
|
|
106
|
-
forceWidth: width,
|
|
117
|
+
renderId: res.renderId,
|
|
107
118
|
});
|
|
108
|
-
log_1.Log.info(cli_1.CliInternals.
|
|
109
|
-
log_1.Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);
|
|
110
|
-
if (downloadName) {
|
|
111
|
-
log_1.Log.info('Finished rendering. Downloading...');
|
|
112
|
-
const { outputPath, sizeInBytes } = await (0, download_media_1.downloadMedia)({
|
|
113
|
-
bucketName: res.bucketName,
|
|
114
|
-
outPath: downloadName,
|
|
115
|
-
region,
|
|
116
|
-
renderId: res.renderId,
|
|
117
|
-
});
|
|
118
|
-
log_1.Log.info('Done!', outputPath, cli_1.CliInternals.formatBytes(sizeInBytes));
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
log_1.Log.info(`Finished still!`);
|
|
122
|
-
log_1.Log.info();
|
|
123
|
-
log_1.Log.info(res.url);
|
|
124
|
-
}
|
|
119
|
+
log_1.Log.info('Done!', outputPath, cli_1.CliInternals.formatBytes(sizeInBytes));
|
|
125
120
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
frame: null,
|
|
131
|
-
name: err.name,
|
|
132
|
-
stack: err.stack,
|
|
133
|
-
stackFrame: frames,
|
|
134
|
-
});
|
|
135
|
-
await cli_1.CliInternals.handleCommonError(errorWithStackFrame, renderer_1.RenderInternals.getLogLevel());
|
|
136
|
-
(0, quit_1.quit)(1);
|
|
121
|
+
else {
|
|
122
|
+
log_1.Log.info(`Finished still!`);
|
|
123
|
+
log_1.Log.info();
|
|
124
|
+
log_1.Log.info(res.url);
|
|
137
125
|
}
|
|
138
126
|
};
|
|
139
127
|
exports.stillCommand = stillCommand;
|
package/dist/cli/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cli = exports.executeCommand = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
7
|
const suggested_policy_1 = require("../api/iam-validation/suggested-policy");
|
|
7
8
|
const defaults_1 = require("../defaults");
|
|
@@ -97,7 +98,7 @@ const matchCommand = (args, remotionRoot) => {
|
|
|
97
98
|
(0, quit_1.quit)(1);
|
|
98
99
|
};
|
|
99
100
|
const executeCommand = async (args, remotionRoot) => {
|
|
100
|
-
var _a, _b, _c;
|
|
101
|
+
var _a, _b, _c, _d, _e;
|
|
101
102
|
try {
|
|
102
103
|
(0, is_cli_1.setIsCli)(true);
|
|
103
104
|
await matchCommand(args, remotionRoot);
|
|
@@ -137,7 +138,20 @@ AWS returned an "TooManyRequestsException" error message which could mean you re
|
|
|
137
138
|
AWS returned an error message "The security token included in the request is invalid". A possible reason for this is that you did not enable the region in your AWS account under "Account". The original message is:
|
|
138
139
|
`);
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
+
if (error instanceof renderer_1.RenderInternals.SymbolicateableError) {
|
|
142
|
+
await cli_1.CliInternals.handleCommonError(error, config_1.ConfigInternals.Logging.getLogLevel());
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const frames = renderer_1.RenderInternals.parseStack((_e = (_d = error.stack) === null || _d === void 0 ? void 0 : _d.split('\n')) !== null && _e !== void 0 ? _e : []);
|
|
146
|
+
const errorWithStackFrame = new renderer_1.RenderInternals.SymbolicateableError({
|
|
147
|
+
message: error.message,
|
|
148
|
+
frame: null,
|
|
149
|
+
name: error.name,
|
|
150
|
+
stack: error.stack,
|
|
151
|
+
stackFrame: frames,
|
|
152
|
+
});
|
|
153
|
+
await cli_1.CliInternals.handleCommonError(errorWithStackFrame, config_1.ConfigInternals.Logging.getLogLevel());
|
|
154
|
+
}
|
|
141
155
|
(0, quit_1.quit)(1);
|
|
142
156
|
}
|
|
143
157
|
};
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -17,4 +17,10 @@ export declare const Log: {
|
|
|
17
17
|
logLevel: "verbose" | "info" | "warn" | "error";
|
|
18
18
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
|
+
errorAdvanced: (options: {
|
|
21
|
+
indent: boolean;
|
|
22
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
23
|
+
} & {
|
|
24
|
+
tag?: string | undefined;
|
|
25
|
+
}, message?: any, ...optionalParams: any[]) => void;
|
|
20
26
|
};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { getCompositionsOnLambda } from './api/get-compositions-on-lambda';
|
|
2
2
|
import { getFunctions } from './api/get-functions';
|
|
3
|
+
import type { GetRenderProgressInput } from './api/get-render-progress';
|
|
3
4
|
import { getRenderProgress } from './api/get-render-progress';
|
|
4
5
|
import { getSites } from './api/get-sites';
|
|
5
6
|
import type { PresignUrlInput } from './api/presign-url';
|
|
6
7
|
import { presignUrl } from './api/presign-url';
|
|
8
|
+
import type { RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput } from './api/render-media-on-lambda';
|
|
7
9
|
import { renderMediaOnLambda, renderVideoOnLambda } from './api/render-media-on-lambda';
|
|
10
|
+
import type { RenderStillOnLambdaInput, RenderStillOnLambdaOutput } from './api/render-still-on-lambda';
|
|
8
11
|
import { renderStillOnLambda } from './api/render-still-on-lambda';
|
|
9
12
|
import type { SpeculateFunctionNameInput } from './api/speculate-function-name';
|
|
10
13
|
import { speculateFunctionName } from './api/speculate-function-name';
|
|
@@ -13,4 +16,4 @@ import type { AwsRegion } from './pricing/aws-regions';
|
|
|
13
16
|
import type { RenderProgress } from './shared/constants';
|
|
14
17
|
import type { WebhookPayload } from './shared/invoke-webhook';
|
|
15
18
|
export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, getCompositionsOnLambda, presignUrl, getSites, speculateFunctionName, };
|
|
16
|
-
export type { AwsRegion, RenderProgress, SpeculateFunctionNameInput, WebhookPayload, PresignUrlInput, };
|
|
19
|
+
export type { AwsRegion, RenderProgress, SpeculateFunctionNameInput, WebhookPayload, PresignUrlInput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, GetRenderProgressInput, };
|
|
@@ -5,10 +5,10 @@ const renderer_1 = require("@remotion/renderer");
|
|
|
5
5
|
const version_1 = require("remotion/version");
|
|
6
6
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
7
7
|
const defaults_1 = require("../defaults");
|
|
8
|
+
const compress_props_1 = require("../shared/compress-props");
|
|
8
9
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
9
10
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
10
11
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
11
|
-
const compress_props_1 = require("../shared/compress-props");
|
|
12
12
|
const compositionsHandler = async (lambdaParams, options) => {
|
|
13
13
|
var _a, _b, _c;
|
|
14
14
|
if (lambdaParams.type !== defaults_1.LambdaRoutines.compositions) {
|
|
@@ -55,6 +55,7 @@ const compositionsHandler = async (lambdaParams, options) => {
|
|
|
55
55
|
});
|
|
56
56
|
return Promise.resolve({
|
|
57
57
|
compositions,
|
|
58
|
+
type: 'success',
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
61
|
exports.compositionsHandler = compositionsHandler;
|
|
@@ -71,6 +71,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
71
71
|
mostExpensiveFrameRanges: (_a = postRenderData.mostExpensiveFrameRanges) !== null && _a !== void 0 ? _a : null,
|
|
72
72
|
timeToEncode: postRenderData.timeToEncode,
|
|
73
73
|
outputSizeInBytes: postRenderData.outputSize,
|
|
74
|
+
type: 'success',
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
const contents = await (0, io_1.lambdaLs)({
|
|
@@ -222,6 +223,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
222
223
|
mostExpensiveFrameRanges: null,
|
|
223
224
|
timeToEncode: null,
|
|
224
225
|
outputSizeInBytes: (_j = outputFile === null || outputFile === void 0 ? void 0 : outputFile.size) !== null && _j !== void 0 ? _j : null,
|
|
226
|
+
type: 'success',
|
|
225
227
|
};
|
|
226
228
|
};
|
|
227
229
|
exports.getProgress = getProgress;
|
|
@@ -33,8 +33,11 @@ function isInAWS(handler) {
|
|
|
33
33
|
}
|
|
34
34
|
exports.isInAWS = isInAWS;
|
|
35
35
|
function streamifyResponse(handler) {
|
|
36
|
-
// Check
|
|
37
|
-
if (
|
|
36
|
+
// Check if we are inside Lambda
|
|
37
|
+
if (process.env.AWS_LAMBDA_FUNCTION_VERSION &&
|
|
38
|
+
process.env.AWS_LAMBDA_FUNCTION_NAME &&
|
|
39
|
+
// @ts-expect-error
|
|
40
|
+
typeof awslambda !== 'undefined') {
|
|
38
41
|
// @ts-expect-error
|
|
39
42
|
return awslambda.streamifyResponse(handler);
|
|
40
43
|
}
|
|
@@ -43,16 +46,16 @@ function streamifyResponse(handler) {
|
|
|
43
46
|
const responseStream = patchArgs(argList);
|
|
44
47
|
await target(...argList);
|
|
45
48
|
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
EventStream: [
|
|
50
|
+
{
|
|
51
|
+
PayloadChunk: {
|
|
52
|
+
Payload: responseStream._isBase64Encoded
|
|
53
|
+
? responseStream.getBufferedData()
|
|
54
|
+
: responseStream.getBufferedData(),
|
|
55
|
+
},
|
|
56
|
+
InvokeComplete: true,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
56
59
|
};
|
|
57
60
|
},
|
|
58
61
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ResponseStream } from './streamify-response';
|
|
3
|
+
declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"render-id-determined">;
|
|
5
|
+
renderId: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
renderId: string;
|
|
8
|
+
type: "render-id-determined";
|
|
9
|
+
}, {
|
|
10
|
+
renderId: string;
|
|
11
|
+
type: "render-id-determined";
|
|
12
|
+
}>]>;
|
|
13
|
+
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
|
+
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
+
renderId: string;
|
|
16
|
+
type: "render-id-determined";
|
|
17
|
+
};
|
|
18
|
+
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendProgressEvent = exports.isStreamingPayload = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const streamingPayloadSchema = zod_1.z.discriminatedUnion('type', [
|
|
6
|
+
zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal('render-id-determined'),
|
|
8
|
+
renderId: zod_1.z.string(),
|
|
9
|
+
}),
|
|
10
|
+
]);
|
|
11
|
+
const isStreamingPayload = (str) => {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(str);
|
|
14
|
+
return streamingPayloadSchema.parse(parsed);
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.isStreamingPayload = isStreamingPayload;
|
|
21
|
+
const sendProgressEvent = (responseStream, payload) => {
|
|
22
|
+
const stringified = JSON.stringify(payload);
|
|
23
|
+
responseStream.write(stringified);
|
|
24
|
+
};
|
|
25
|
+
exports.sendProgressEvent = sendProgressEvent;
|
package/dist/functions/index.js
CHANGED
|
@@ -3,18 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handler = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const constants_1 = require("../shared/constants");
|
|
6
|
+
const random_hash_1 = require("../shared/random-hash");
|
|
6
7
|
const compositions_1 = require("./compositions");
|
|
7
8
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
8
9
|
const is_warm_1 = require("./helpers/is-warm");
|
|
9
10
|
const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
|
|
10
11
|
const streamify_response_1 = require("./helpers/streamify-response");
|
|
12
|
+
const streaming_payloads_1 = require("./helpers/streaming-payloads");
|
|
11
13
|
const info_1 = require("./info");
|
|
12
14
|
const launch_1 = require("./launch");
|
|
13
15
|
const progress_1 = require("./progress");
|
|
14
16
|
const renderer_2 = require("./renderer");
|
|
15
17
|
const start_1 = require("./start");
|
|
16
18
|
const still_1 = require("./still");
|
|
17
|
-
|
|
19
|
+
const innerHandler = async (params, responseStream, context) => {
|
|
18
20
|
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
19
21
|
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
20
22
|
if (!(context === null || context === void 0 ? void 0 : context.invokedFunctionArn)) {
|
|
@@ -25,12 +27,21 @@ exports.handler = (0, streamify_response_1.streamifyResponse)(async (params, res
|
|
|
25
27
|
(0, is_warm_1.setWarm)();
|
|
26
28
|
const currentUserId = context.invokedFunctionArn.split(':')[4];
|
|
27
29
|
if (params.type === constants_1.LambdaRoutines.still) {
|
|
30
|
+
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
28
31
|
(0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.still, {
|
|
32
|
+
renderId,
|
|
29
33
|
inputProps: JSON.stringify(params.inputProps),
|
|
30
34
|
isWarm,
|
|
31
35
|
});
|
|
32
|
-
const
|
|
36
|
+
const renderIdDetermined = {
|
|
37
|
+
type: 'render-id-determined',
|
|
38
|
+
renderId,
|
|
39
|
+
};
|
|
40
|
+
(0, streaming_payloads_1.sendProgressEvent)(responseStream, renderIdDetermined);
|
|
41
|
+
const response = await (0, still_1.stillHandler)({
|
|
33
42
|
expectedBucketOwner: currentUserId,
|
|
43
|
+
params,
|
|
44
|
+
renderId,
|
|
34
45
|
});
|
|
35
46
|
responseStream.write(JSON.stringify(response));
|
|
36
47
|
responseStream.end();
|
|
@@ -54,10 +65,11 @@ exports.handler = (0, streamify_response_1.streamifyResponse)(async (params, res
|
|
|
54
65
|
inputProps: JSON.stringify(params.inputProps),
|
|
55
66
|
isWarm,
|
|
56
67
|
});
|
|
57
|
-
await (0, launch_1.launchHandler)(params, {
|
|
68
|
+
const response = await (0, launch_1.launchHandler)(params, {
|
|
58
69
|
expectedBucketOwner: currentUserId,
|
|
59
70
|
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
60
71
|
});
|
|
72
|
+
responseStream.write(JSON.stringify(response));
|
|
61
73
|
responseStream.end();
|
|
62
74
|
return;
|
|
63
75
|
}
|
|
@@ -82,10 +94,11 @@ exports.handler = (0, streamify_response_1.streamifyResponse)(async (params, res
|
|
|
82
94
|
resolvedProps: JSON.stringify(params.resolvedProps),
|
|
83
95
|
isWarm,
|
|
84
96
|
});
|
|
85
|
-
await (0, renderer_2.rendererHandler)(params, {
|
|
97
|
+
const response = await (0, renderer_2.rendererHandler)(params, {
|
|
86
98
|
expectedBucketOwner: currentUserId,
|
|
87
99
|
isWarm,
|
|
88
100
|
});
|
|
101
|
+
responseStream.write(JSON.stringify(response));
|
|
89
102
|
responseStream.end();
|
|
90
103
|
return;
|
|
91
104
|
}
|
|
@@ -110,4 +123,19 @@ exports.handler = (0, streamify_response_1.streamifyResponse)(async (params, res
|
|
|
110
123
|
return;
|
|
111
124
|
}
|
|
112
125
|
throw new Error(constants_1.COMMAND_NOT_FOUND);
|
|
113
|
-
}
|
|
126
|
+
};
|
|
127
|
+
const routine = async (params, responseStream, context) => {
|
|
128
|
+
try {
|
|
129
|
+
await innerHandler(params, responseStream, context);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
const res = {
|
|
133
|
+
type: 'error',
|
|
134
|
+
message: err.message,
|
|
135
|
+
stack: err.stack,
|
|
136
|
+
};
|
|
137
|
+
responseStream.write(JSON.stringify(res));
|
|
138
|
+
responseStream.end();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.handler = (0, streamify_response_1.streamifyResponse)(routine);
|
package/dist/functions/info.d.ts
CHANGED
package/dist/functions/info.js
CHANGED
|
@@ -3,5 +3,7 @@ type Options = {
|
|
|
3
3
|
expectedBucketOwner: string;
|
|
4
4
|
getRemainingTimeInMillis: () => number;
|
|
5
5
|
};
|
|
6
|
-
export declare const launchHandler: (params: LambdaPayload, options: Options) => Promise<
|
|
6
|
+
export declare const launchHandler: (params: LambdaPayload, options: Options) => Promise<{
|
|
7
|
+
type: 'success';
|
|
8
|
+
}>;
|
|
7
9
|
export {};
|
package/dist/functions/launch.js
CHANGED
|
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.launchHandler = void 0;
|
|
27
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
28
27
|
const renderer_1 = require("@remotion/renderer");
|
|
29
28
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
30
29
|
const node_path_1 = require("node:path");
|
|
31
30
|
const remotion_1 = require("remotion");
|
|
32
31
|
const version_1 = require("remotion/version");
|
|
33
|
-
const
|
|
32
|
+
const call_lambda_1 = require("../shared/call-lambda");
|
|
34
33
|
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
34
|
+
const compress_props_1 = require("../shared/compress-props");
|
|
35
35
|
const constants_1 = require("../shared/constants");
|
|
36
36
|
const docs_url_1 = require("../shared/docs-url");
|
|
37
37
|
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
@@ -56,15 +56,16 @@ const timer_1 = require("./helpers/timer");
|
|
|
56
56
|
const validate_composition_1 = require("./helpers/validate-composition");
|
|
57
57
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
58
58
|
const write_post_render_data_1 = require("./helpers/write-post-render-data");
|
|
59
|
-
const compress_props_1 = require("../shared/compress-props");
|
|
60
59
|
const callFunctionWithRetry = async ({ payload, retries, functionName, }) => {
|
|
61
60
|
try {
|
|
62
|
-
await (0,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
await (0, call_lambda_1.callLambda)({
|
|
62
|
+
functionName,
|
|
63
|
+
payload,
|
|
64
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
65
|
+
type: constants_1.LambdaRoutines.renderer,
|
|
66
|
+
receivedStreamingPayload: () => undefined,
|
|
67
|
+
timeoutInTest: 120000,
|
|
68
|
+
});
|
|
68
69
|
}
|
|
69
70
|
catch (err) {
|
|
70
71
|
if (err.name === 'ResourceConflictException') {
|
|
@@ -537,6 +538,9 @@ const launchHandler = async (params, options) => {
|
|
|
537
538
|
}
|
|
538
539
|
try {
|
|
539
540
|
await innerLaunchHandler(params, options);
|
|
541
|
+
return {
|
|
542
|
+
type: 'success',
|
|
543
|
+
};
|
|
540
544
|
}
|
|
541
545
|
catch (err) {
|
|
542
546
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -605,6 +609,7 @@ const launchHandler = async (params, options) => {
|
|
|
605
609
|
console.log(error);
|
|
606
610
|
}
|
|
607
611
|
}
|
|
612
|
+
throw err;
|
|
608
613
|
}
|
|
609
614
|
};
|
|
610
615
|
exports.launchHandler = launchHandler;
|
|
@@ -3,5 +3,7 @@ type Options = {
|
|
|
3
3
|
expectedBucketOwner: string;
|
|
4
4
|
isWarm: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const rendererHandler: (params: LambdaPayload, options: Options) => Promise<
|
|
6
|
+
export declare const rendererHandler: (params: LambdaPayload, options: Options) => Promise<{
|
|
7
|
+
type: 'success';
|
|
8
|
+
}>;
|
|
7
9
|
export {};
|
|
@@ -4,20 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.rendererHandler = void 0;
|
|
7
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
7
|
const renderer_1 = require("@remotion/renderer");
|
|
9
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
10
|
const version_1 = require("remotion/version");
|
|
12
|
-
const
|
|
11
|
+
const call_lambda_1 = require("../shared/call-lambda");
|
|
13
12
|
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
13
|
+
const compress_props_1 = require("../shared/compress-props");
|
|
14
14
|
const constants_1 = require("../shared/constants");
|
|
15
15
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
16
16
|
const get_chromium_executable_path_1 = require("./helpers/get-chromium-executable-path");
|
|
17
17
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
18
18
|
const io_1 = require("./helpers/io");
|
|
19
19
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
20
|
-
const compress_props_1 = require("../shared/compress-props");
|
|
21
20
|
const renderHandler = async (params, options, logs) => {
|
|
22
21
|
var _a;
|
|
23
22
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
@@ -214,6 +213,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
214
213
|
customCredentials: null,
|
|
215
214
|
}),
|
|
216
215
|
]);
|
|
216
|
+
return {};
|
|
217
217
|
};
|
|
218
218
|
const rendererHandler = async (params, options) => {
|
|
219
219
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
@@ -222,6 +222,9 @@ const rendererHandler = async (params, options) => {
|
|
|
222
222
|
const logs = [];
|
|
223
223
|
try {
|
|
224
224
|
await renderHandler(params, options, logs);
|
|
225
|
+
return {
|
|
226
|
+
type: 'success',
|
|
227
|
+
};
|
|
225
228
|
}
|
|
226
229
|
catch (err) {
|
|
227
230
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -260,13 +263,17 @@ const rendererHandler = async (params, options) => {
|
|
|
260
263
|
retriesLeft: params.retriesLeft - 1,
|
|
261
264
|
attempt: params.attempt + 1,
|
|
262
265
|
};
|
|
263
|
-
await (0,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
267
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
268
|
+
payload: retryPayload,
|
|
269
|
+
type: constants_1.LambdaRoutines.renderer,
|
|
270
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
271
|
+
receivedStreamingPayload: () => undefined,
|
|
272
|
+
timeoutInTest: 120000,
|
|
273
|
+
});
|
|
274
|
+
return res;
|
|
269
275
|
}
|
|
276
|
+
throw err;
|
|
270
277
|
}
|
|
271
278
|
};
|
|
272
279
|
exports.rendererHandler = rendererHandler;
|
package/dist/functions/start.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.startHandler = void 0;
|
|
4
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
5
4
|
const version_1 = require("remotion/version");
|
|
6
5
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
7
|
-
const
|
|
6
|
+
const call_lambda_1 = require("../shared/call-lambda");
|
|
8
7
|
const constants_1 = require("../shared/constants");
|
|
9
8
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
10
9
|
const random_hash_1 = require("../shared/random-hash");
|
|
@@ -78,14 +77,17 @@ const startHandler = async (params, options) => {
|
|
|
78
77
|
rendererFunctionName: params.rendererFunctionName,
|
|
79
78
|
audioCodec: params.audioCodec,
|
|
80
79
|
};
|
|
81
|
-
await (0,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
await (0, call_lambda_1.callLambda)({
|
|
81
|
+
payload,
|
|
82
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
83
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
84
|
+
type: constants_1.LambdaRoutines.launch,
|
|
85
|
+
receivedStreamingPayload: () => undefined,
|
|
86
|
+
timeoutInTest: 120000,
|
|
87
|
+
});
|
|
87
88
|
await initialFile;
|
|
88
89
|
return {
|
|
90
|
+
type: 'success',
|
|
89
91
|
bucketName,
|
|
90
92
|
renderId,
|
|
91
93
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type { LambdaPayload } from '../shared/constants';
|
|
1
|
+
import type { CostsInfo, LambdaPayload } from '../shared/constants';
|
|
2
2
|
type Options = {
|
|
3
|
+
params: LambdaPayload;
|
|
4
|
+
renderId: string;
|
|
3
5
|
expectedBucketOwner: string;
|
|
4
6
|
};
|
|
5
|
-
|
|
7
|
+
type RenderStillLambdaResponsePayload = {
|
|
8
|
+
type: 'success';
|
|
6
9
|
output: string;
|
|
7
10
|
size: number;
|
|
8
11
|
bucketName: string;
|
|
9
|
-
estimatedPrice:
|
|
12
|
+
estimatedPrice: CostsInfo;
|
|
10
13
|
renderId: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const stillHandler: (
|
|
14
|
+
};
|
|
15
|
+
export declare const stillHandler: (options: Options) => Promise<RenderStillLambdaResponsePayload>;
|
|
13
16
|
export {};
|
package/dist/functions/still.js
CHANGED
|
@@ -4,19 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.stillHandler = void 0;
|
|
7
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
7
|
const renderer_1 = require("@remotion/renderer");
|
|
9
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const remotion_1 = require("remotion");
|
|
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");
|
|
14
|
-
const
|
|
14
|
+
const call_lambda_1 = require("../shared/call-lambda");
|
|
15
15
|
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
16
|
+
const compress_props_1 = require("../shared/compress-props");
|
|
16
17
|
const constants_1 = require("../shared/constants");
|
|
17
18
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
18
19
|
const make_s3_url_1 = require("../shared/make-s3-url");
|
|
19
|
-
const random_hash_1 = require("../shared/random-hash");
|
|
20
20
|
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
21
21
|
const validate_outname_1 = require("../shared/validate-outname");
|
|
22
22
|
const validate_privacy_1 = require("../shared/validate-privacy");
|
|
@@ -29,9 +29,7 @@ const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-me
|
|
|
29
29
|
const io_1 = require("./helpers/io");
|
|
30
30
|
const validate_composition_1 = require("./helpers/validate-composition");
|
|
31
31
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
32
|
-
const
|
|
33
|
-
const remotion_1 = require("remotion");
|
|
34
|
-
const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
32
|
+
const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, renderId, }) => {
|
|
35
33
|
var _a, _b, _c, _d, _e, _f;
|
|
36
34
|
if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
|
|
37
35
|
throw new TypeError('Expected still type');
|
|
@@ -57,7 +55,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
57
55
|
const region = (0, get_current_region_1.getCurrentRegionInFunction)();
|
|
58
56
|
const serializedInputPropsWithCustomSchema = await (0, compress_props_1.decompressInputProps)({
|
|
59
57
|
bucketName,
|
|
60
|
-
expectedBucketOwner
|
|
58
|
+
expectedBucketOwner,
|
|
61
59
|
region,
|
|
62
60
|
serialized: lambdaParams.inputProps,
|
|
63
61
|
propsType: 'input-props',
|
|
@@ -118,7 +116,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
118
116
|
body: JSON.stringify(renderMetadata),
|
|
119
117
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
120
118
|
privacy: 'private',
|
|
121
|
-
expectedBucketOwner
|
|
119
|
+
expectedBucketOwner,
|
|
122
120
|
downloadBehavior: null,
|
|
123
121
|
customCredentials: null,
|
|
124
122
|
});
|
|
@@ -132,11 +130,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
132
130
|
durationInFrames: composition.durationInFrames,
|
|
133
131
|
}),
|
|
134
132
|
imageFormat: lambdaParams.imageFormat,
|
|
135
|
-
serializedInputPropsWithCustomSchema
|
|
136
|
-
data: lambdaParams.inputProps,
|
|
137
|
-
indent: undefined,
|
|
138
|
-
staticBase: null,
|
|
139
|
-
}).serializedString,
|
|
133
|
+
serializedInputPropsWithCustomSchema,
|
|
140
134
|
overwrite: false,
|
|
141
135
|
puppeteerInstance: browserInstance,
|
|
142
136
|
jpegQuality: (_f = lambdaParams.jpegQuality) !== null && _f !== void 0 ? _f : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
|
|
@@ -164,7 +158,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
164
158
|
key,
|
|
165
159
|
privacy: lambdaParams.privacy,
|
|
166
160
|
body: node_fs_1.default.createReadStream(outputPath),
|
|
167
|
-
expectedBucketOwner
|
|
161
|
+
expectedBucketOwner,
|
|
168
162
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
169
163
|
downloadBehavior: lambdaParams.downloadBehavior,
|
|
170
164
|
customCredentials,
|
|
@@ -188,6 +182,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
188
182
|
diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
189
183
|
});
|
|
190
184
|
return {
|
|
185
|
+
type: 'success',
|
|
191
186
|
output: (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, bucketName, customCredentials),
|
|
192
187
|
size,
|
|
193
188
|
bucketName,
|
|
@@ -195,14 +190,14 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
195
190
|
renderId,
|
|
196
191
|
};
|
|
197
192
|
};
|
|
198
|
-
const stillHandler = async (
|
|
193
|
+
const stillHandler = async (options) => {
|
|
199
194
|
var _a;
|
|
195
|
+
const { params } = options;
|
|
200
196
|
if (params.type !== constants_1.LambdaRoutines.still) {
|
|
201
197
|
throw new Error('Params must be renderer');
|
|
202
198
|
}
|
|
203
|
-
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
204
199
|
try {
|
|
205
|
-
return innerStillHandler(
|
|
200
|
+
return await innerStillHandler(options);
|
|
206
201
|
}
|
|
207
202
|
catch (err) {
|
|
208
203
|
// If this error is encountered, we can just retry as it
|
|
@@ -210,44 +205,46 @@ const stillHandler = async (params, options) => {
|
|
|
210
205
|
const isBrowserError = err.message.includes('FATAL:zygote_communication_linux.cc') ||
|
|
211
206
|
err.message.includes('error while loading shared libraries: libnss3.so');
|
|
212
207
|
const willRetry = isBrowserError || params.maxRetries > 0;
|
|
213
|
-
if (willRetry) {
|
|
214
|
-
|
|
215
|
-
...params,
|
|
216
|
-
maxRetries: params.maxRetries - 1,
|
|
217
|
-
attempt: params.attempt + 1,
|
|
218
|
-
};
|
|
219
|
-
const res = await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
220
|
-
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
221
|
-
// @ts-expect-error
|
|
222
|
-
Payload: JSON.stringify(retryPayload),
|
|
223
|
-
}));
|
|
224
|
-
const bucketName = (_a = params.bucketName) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
225
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
226
|
-
})).bucketName;
|
|
227
|
-
// `await` elided on purpose here; using `void` to mark it as intentional
|
|
228
|
-
// eslint-disable-next-line no-void
|
|
229
|
-
void (0, write_lambda_error_1.writeLambdaError)({
|
|
230
|
-
bucketName,
|
|
231
|
-
errorInfo: {
|
|
232
|
-
chunk: null,
|
|
233
|
-
frame: null,
|
|
234
|
-
isFatal: false,
|
|
235
|
-
name: err.name,
|
|
236
|
-
message: err.message,
|
|
237
|
-
stack: err.stack,
|
|
238
|
-
type: 'browser',
|
|
239
|
-
tmpDir: (0, write_lambda_error_1.getTmpDirStateIfENoSp)(err.stack),
|
|
240
|
-
attempt: params.attempt,
|
|
241
|
-
totalAttempts: params.attempt + params.maxRetries,
|
|
242
|
-
willRetry,
|
|
243
|
-
},
|
|
244
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
245
|
-
renderId,
|
|
246
|
-
});
|
|
247
|
-
const str = JSON.parse(Buffer.from(res.Payload).toString());
|
|
248
|
-
return str;
|
|
208
|
+
if (!willRetry) {
|
|
209
|
+
throw err;
|
|
249
210
|
}
|
|
250
|
-
|
|
211
|
+
const retryPayload = {
|
|
212
|
+
...params,
|
|
213
|
+
maxRetries: params.maxRetries - 1,
|
|
214
|
+
attempt: params.attempt + 1,
|
|
215
|
+
};
|
|
216
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
217
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
218
|
+
payload: retryPayload,
|
|
219
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
220
|
+
type: constants_1.LambdaRoutines.still,
|
|
221
|
+
receivedStreamingPayload: () => undefined,
|
|
222
|
+
timeoutInTest: 120000,
|
|
223
|
+
});
|
|
224
|
+
const bucketName = (_a = params.bucketName) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
225
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
226
|
+
})).bucketName;
|
|
227
|
+
// `await` elided on purpose here; using `void` to mark it as intentional
|
|
228
|
+
// eslint-disable-next-line no-void
|
|
229
|
+
void (0, write_lambda_error_1.writeLambdaError)({
|
|
230
|
+
bucketName,
|
|
231
|
+
errorInfo: {
|
|
232
|
+
chunk: null,
|
|
233
|
+
frame: null,
|
|
234
|
+
isFatal: false,
|
|
235
|
+
name: err.name,
|
|
236
|
+
message: err.message,
|
|
237
|
+
stack: err.stack,
|
|
238
|
+
type: 'browser',
|
|
239
|
+
tmpDir: (0, write_lambda_error_1.getTmpDirStateIfENoSp)(err.stack),
|
|
240
|
+
attempt: params.attempt,
|
|
241
|
+
totalAttempts: params.attempt + params.maxRetries,
|
|
242
|
+
willRetry,
|
|
243
|
+
},
|
|
244
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
245
|
+
renderId: options.renderId,
|
|
246
|
+
});
|
|
247
|
+
return res;
|
|
251
248
|
}
|
|
252
249
|
};
|
|
253
250
|
exports.stillHandler = stillHandler;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { getFunctions } from './api/get-functions';
|
|
|
23
23
|
import type { GetOrCreateBucketInput, GetOrCreateBucketOutput } from './api/get-or-create-bucket';
|
|
24
24
|
import { getOrCreateBucket } from './api/get-or-create-bucket';
|
|
25
25
|
import { getRegions } from './api/get-regions';
|
|
26
|
-
import type {
|
|
26
|
+
import type { GetRenderProgressInput } from './api/get-render-progress';
|
|
27
27
|
import { getRenderProgress } from './api/get-render-progress';
|
|
28
28
|
import type { GetSitesInput, GetSitesOutput } from './api/get-sites';
|
|
29
29
|
import type { SimulatePermissionsInput, SimulatePermissionsOutput } from './api/iam-validation/simulate';
|
|
@@ -47,7 +47,7 @@ declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<
|
|
|
47
47
|
/**
|
|
48
48
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
49
49
|
*/
|
|
50
|
-
declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
50
|
+
declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, onInit, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
51
51
|
/**
|
|
52
52
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
53
53
|
*/
|
|
@@ -57,4 +57,4 @@ declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region
|
|
|
57
57
|
*/
|
|
58
58
|
declare const getSites: ({ region, forceBucketName, }: GetSitesInput) => Promise<GetSitesOutput>;
|
|
59
59
|
export { deleteSite, deployFunction, deploySite, downloadMedia, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, getCompositionsOnLambda, };
|
|
60
|
-
export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput,
|
|
60
|
+
export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput, GetRenderProgressInput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, SimulatePermissionsInput, SimulatePermissionsOutput, GetAwsClientInput, GetAwsClientOutput, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, GetCompositionsOnLambdaOutput, GetCompositionsOnLambdaInput, };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const LambdaInternals: {
|
|
2
2
|
executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
|
|
3
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(".").
|
|
4
|
+
getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: import(".").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
|
|
5
5
|
};
|
|
@@ -27,7 +27,7 @@ export declare const getServiceClient: <T extends keyof ServiceMapping>({ region
|
|
|
27
27
|
}) => ServiceMapping[T];
|
|
28
28
|
export declare const getCloudWatchLogsClient: (region: AwsRegion) => CloudWatchLogsClient;
|
|
29
29
|
export declare const getS3Client: (region: AwsRegion, customCredentials: CustomCredentials | null) => S3Client;
|
|
30
|
-
export declare const getLambdaClient: (region: AwsRegion) => LambdaClient;
|
|
30
|
+
export declare const getLambdaClient: (region: AwsRegion, _timeoutInTest?: number) => LambdaClient;
|
|
31
31
|
export declare const getIamClient: (region: AwsRegion) => IAMClient;
|
|
32
32
|
export declare const getServiceQuotasClient: (region: AwsRegion) => ServiceQuotasClient;
|
|
33
33
|
export declare const getStsClient: (region: AwsRegion) => STSClient;
|
|
@@ -157,7 +157,9 @@ const getS3Client = (region, customCredentials) => {
|
|
|
157
157
|
return (0, exports.getServiceClient)({ region, service: 's3', customCredentials });
|
|
158
158
|
};
|
|
159
159
|
exports.getS3Client = getS3Client;
|
|
160
|
-
const getLambdaClient = (region
|
|
160
|
+
const getLambdaClient = (region,
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
162
|
+
_timeoutInTest) => {
|
|
161
163
|
return (0, exports.getServiceClient)({
|
|
162
164
|
region,
|
|
163
165
|
service: 'lambda',
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { StreamingPayloads } from '../functions/helpers/streaming-payloads';
|
|
1
2
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
3
|
import type { LambdaPayloads, LambdaRoutines } from './constants';
|
|
3
4
|
import type { LambdaReturnValues } from './return-values';
|
|
4
|
-
export declare const callLambda: <T extends LambdaRoutines>({ functionName, type, payload, region, }: {
|
|
5
|
+
export declare const callLambda: <T extends LambdaRoutines>({ functionName, type, payload, region, receivedStreamingPayload, timeoutInTest, }: {
|
|
5
6
|
functionName: string;
|
|
6
7
|
type: T;
|
|
7
8
|
payload: Omit<LambdaPayloads[T], "type">;
|
|
8
9
|
region: AwsRegion;
|
|
10
|
+
receivedStreamingPayload: (streamPayload: StreamingPayloads) => void;
|
|
11
|
+
timeoutInTest: number;
|
|
9
12
|
}) => Promise<LambdaReturnValues[T]>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.callLambda = void 0;
|
|
4
4
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
5
|
+
const streaming_payloads_1 = require("../functions/helpers/streaming-payloads");
|
|
5
6
|
const aws_clients_1 = require("./aws-clients");
|
|
6
|
-
const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
7
|
-
|
|
8
|
-
const res = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
7
|
+
const callLambda = async ({ functionName, type, payload, region, receivedStreamingPayload, timeoutInTest, }) => {
|
|
8
|
+
const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
9
9
|
FunctionName: functionName,
|
|
10
10
|
// @ts-expect-error
|
|
11
11
|
Payload: JSON.stringify({ type, ...payload }),
|
|
@@ -19,30 +19,44 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
|
19
19
|
if (event.PayloadChunk) {
|
|
20
20
|
// Decode the raw bytes into a string a human can read
|
|
21
21
|
const decoded = new TextDecoder('utf-8').decode(event.PayloadChunk.Payload);
|
|
22
|
+
const streamPayload = (0, streaming_payloads_1.isStreamingPayload)(decoded);
|
|
23
|
+
if (streamPayload) {
|
|
24
|
+
receivedStreamingPayload(streamPayload);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
22
27
|
responsePayload = Buffer.concat([responsePayload, Buffer.from(decoded)]);
|
|
23
28
|
}
|
|
24
29
|
if (event.InvokeComplete) {
|
|
25
30
|
if (event.InvokeComplete.ErrorCode) {
|
|
26
|
-
throw new Error(`Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}
|
|
31
|
+
throw new Error(`Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}`);
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
const string = Buffer.from(responsePayload).toString();
|
|
31
|
-
const json =
|
|
36
|
+
const json = parseJson(string);
|
|
37
|
+
return json;
|
|
38
|
+
};
|
|
39
|
+
exports.callLambda = callLambda;
|
|
40
|
+
const parseJson = (input) => {
|
|
41
|
+
var _a;
|
|
42
|
+
let json = JSON.parse(input);
|
|
43
|
+
if ('statusCode' in json) {
|
|
44
|
+
json = JSON.parse(json.body);
|
|
45
|
+
}
|
|
32
46
|
if ('errorMessage' in json) {
|
|
33
47
|
const err = new Error(json.errorMessage);
|
|
34
48
|
err.name = json.errorType;
|
|
35
49
|
err.stack = ((_a = json.trace) !== null && _a !== void 0 ? _a : []).join('\n');
|
|
36
50
|
throw err;
|
|
37
51
|
}
|
|
38
|
-
//
|
|
52
|
+
// This will not happen, it is for narrowing purposes
|
|
39
53
|
if ('statusCode' in json) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
throw new Error(`Lambda function failed with status code ${json.statusCode}`);
|
|
55
|
+
}
|
|
56
|
+
if (json.type === 'error') {
|
|
57
|
+
const err = new Error(json.message);
|
|
58
|
+
err.stack = json.stack;
|
|
59
|
+
throw err;
|
|
44
60
|
}
|
|
45
|
-
// Non-streaming: 3.3.95 and below
|
|
46
61
|
return json;
|
|
47
62
|
};
|
|
48
|
-
exports.callLambda = callLambda;
|
|
@@ -5,8 +5,8 @@ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
|
5
5
|
const io_1 = require("../functions/helpers/io");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
const random_hash_1 = require("./random-hash");
|
|
8
|
-
const stream_to_string_1 = require("./stream-to-string");
|
|
9
8
|
const serialize_props_1 = require("./serialize-props");
|
|
9
|
+
const stream_to_string_1 = require("./stream-to-string");
|
|
10
10
|
const serializeOrThrow = (inputProps, propsType) => {
|
|
11
11
|
try {
|
|
12
12
|
const payload = (0, serialize_props_1.serializeJSONWithDate)({
|
|
@@ -356,6 +356,7 @@ export type RenderProgress = {
|
|
|
356
356
|
mostExpensiveFrameRanges: ExpensiveChunk[] | null;
|
|
357
357
|
framesRendered: number;
|
|
358
358
|
outputSizeInBytes: number | null;
|
|
359
|
+
type: 'success';
|
|
359
360
|
};
|
|
360
361
|
export type Privacy = 'public' | 'private' | 'no-acl';
|
|
361
362
|
export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
|
|
@@ -6,6 +6,11 @@ import type { rendererHandler } from '../functions/renderer';
|
|
|
6
6
|
import type { startHandler } from '../functions/start';
|
|
7
7
|
import type { stillHandler } from '../functions/still';
|
|
8
8
|
import type { LambdaRoutines } from './constants';
|
|
9
|
+
export type OrError<T> = T | {
|
|
10
|
+
type: 'error';
|
|
11
|
+
message: string;
|
|
12
|
+
stack: string;
|
|
13
|
+
};
|
|
9
14
|
export interface LambdaReturnValues {
|
|
10
15
|
[LambdaRoutines.start]: ReturnType<typeof startHandler>;
|
|
11
16
|
[LambdaRoutines.launch]: ReturnType<typeof launchHandler>;
|
|
@@ -15,8 +20,3 @@ export interface LambdaReturnValues {
|
|
|
15
20
|
[LambdaRoutines.still]: ReturnType<typeof stillHandler>;
|
|
16
21
|
[LambdaRoutines.compositions]: ReturnType<typeof compositionsHandler>;
|
|
17
22
|
}
|
|
18
|
-
export type StreamedResponse = {
|
|
19
|
-
statusCode: number;
|
|
20
|
-
headers: Record<string, string>;
|
|
21
|
-
body: string;
|
|
22
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@aws-sdk/s3-request-presigner": "3.338.0",
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
|
-
"
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/renderer": "4.0.
|
|
31
|
-
"remotion": "4.0.
|
|
28
|
+
"remotion": "4.0.6",
|
|
29
|
+
"@remotion/bundler": "4.0.6",
|
|
30
|
+
"@remotion/renderer": "4.0.6",
|
|
31
|
+
"@remotion/cli": "4.0.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -38,16 +38,17 @@
|
|
|
38
38
|
"@types/prompt": "^1.1.0",
|
|
39
39
|
"eslint": "8.42.0",
|
|
40
40
|
"prettier": "^2.4.1",
|
|
41
|
-
"prettier-plugin-organize-imports": "^2.
|
|
41
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
42
42
|
"ts-node": "^10.8.0",
|
|
43
43
|
"typescript": "4.9.5",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"
|
|
47
|
-
"@remotion/
|
|
46
|
+
"zod": "3.21.4",
|
|
47
|
+
"@remotion/bundler": "4.0.6",
|
|
48
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.6"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.6"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|