@remotion/lambda 4.0.6 → 4.0.7
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/render-media-on-lambda.js +2 -2
- package/dist/api/render-still-on-lambda.js +2 -2
- package/dist/cli/log.d.ts +4 -4
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-progress.js +6 -1
- package/dist/functions/helpers/make-timeout-error.d.ts +2 -1
- package/dist/functions/helpers/make-timeout-error.js +7 -6
- package/dist/functions/helpers/make-timeout-message.d.ts +2 -1
- package/dist/functions/helpers/make-timeout-message.js +53 -16
- package/dist/functions/index.js +11 -0
- package/dist/functions/launch.js +7 -9
- package/dist/functions/renderer.js +10 -1
- package/dist/functions/start.js +8 -9
- package/dist/shared/call-lambda.js +5 -2
- package/dist/shared/encode-aws-url-params.d.ts +1 -0
- package/dist/shared/encode-aws-url-params.js +7 -0
- package/dist/shared/get-aws-urls.d.ts +9 -2
- package/dist/shared/get-aws-urls.js +15 -4
- package/dist/shared/invoke-webhook.d.ts +2 -0
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
|
@@ -39,12 +39,12 @@ const renderMediaOnLambda = async (input) => {
|
|
|
39
39
|
return {
|
|
40
40
|
renderId: res.renderId,
|
|
41
41
|
bucketName: res.bucketName,
|
|
42
|
-
cloudWatchLogs: (0, get_aws_urls_1.
|
|
42
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
43
43
|
functionName,
|
|
44
|
-
method: constants_1.LambdaRoutines.renderer,
|
|
45
44
|
region,
|
|
46
45
|
renderId: res.renderId,
|
|
47
46
|
rendererFunctionName: rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : null,
|
|
47
|
+
chunk: null,
|
|
48
48
|
}),
|
|
49
49
|
folderInS3Console: (0, get_aws_urls_1.getS3RenderUrl)({
|
|
50
50
|
bucketName: res.bucketName,
|
|
@@ -66,7 +66,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
66
66
|
if (payload.type === 'render-id-determined') {
|
|
67
67
|
onInit === null || onInit === void 0 ? void 0 : onInit({
|
|
68
68
|
renderId: payload.renderId,
|
|
69
|
-
cloudWatchLogs: (0, get_aws_urls_1.
|
|
69
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
70
70
|
functionName,
|
|
71
71
|
method: constants_1.LambdaRoutines.still,
|
|
72
72
|
region,
|
|
@@ -84,7 +84,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
84
84
|
sizeInBytes: res.size,
|
|
85
85
|
bucketName: res.bucketName,
|
|
86
86
|
renderId: res.renderId,
|
|
87
|
-
cloudWatchLogs: (0, get_aws_urls_1.
|
|
87
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
88
88
|
functionName,
|
|
89
89
|
method: constants_1.LambdaRoutines.still,
|
|
90
90
|
region,
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -2,24 +2,24 @@ export declare const Log: {
|
|
|
2
2
|
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
3
3
|
verboseAdvanced: (options: {
|
|
4
4
|
indent: boolean;
|
|
5
|
-
logLevel: "
|
|
5
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
6
6
|
} & {
|
|
7
7
|
tag?: string | undefined;
|
|
8
8
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
9
9
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
10
10
|
infoAdvanced: (options: {
|
|
11
11
|
indent: boolean;
|
|
12
|
-
logLevel: "
|
|
12
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
13
13
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
14
14
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
15
15
|
warnAdvanced: (options: {
|
|
16
16
|
indent: boolean;
|
|
17
|
-
logLevel: "
|
|
17
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
18
18
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
20
|
errorAdvanced: (options: {
|
|
21
21
|
indent: boolean;
|
|
22
|
-
logLevel: "
|
|
22
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
23
23
|
} & {
|
|
24
24
|
tag?: string | undefined;
|
|
25
25
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-
|
|
1
|
+
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "sa-east-1" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
|
|
@@ -172,7 +172,12 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
172
172
|
Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000;
|
|
173
173
|
const allErrors = [
|
|
174
174
|
isBeyondTimeout
|
|
175
|
-
? (0, make_timeout_error_1.makeTimeoutError)({
|
|
175
|
+
? (0, make_timeout_error_1.makeTimeoutError)({
|
|
176
|
+
timeoutInMilliseconds,
|
|
177
|
+
renderMetadata,
|
|
178
|
+
chunks,
|
|
179
|
+
renderId,
|
|
180
|
+
})
|
|
176
181
|
: null,
|
|
177
182
|
...errorExplanations,
|
|
178
183
|
].filter(remotion_1.Internals.truthy);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
2
|
import type { RenderMetadata } from '../../defaults';
|
|
3
3
|
import type { EnhancedErrorInfo } from './write-lambda-error';
|
|
4
|
-
export declare const makeTimeoutError: ({ timeoutInMilliseconds, chunks, renderMetadata, }: {
|
|
4
|
+
export declare const makeTimeoutError: ({ timeoutInMilliseconds, chunks, renderMetadata, renderId, }: {
|
|
5
5
|
timeoutInMilliseconds: number;
|
|
6
6
|
chunks: _Object[];
|
|
7
7
|
renderMetadata: RenderMetadata;
|
|
8
|
+
renderId: string;
|
|
8
9
|
}) => EnhancedErrorInfo;
|
|
@@ -3,23 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeTimeoutError = void 0;
|
|
4
4
|
const parse_chunk_key_1 = require("../../shared/parse-chunk-key");
|
|
5
5
|
const make_timeout_message_1 = require("./make-timeout-message");
|
|
6
|
-
const makeTimeoutError = ({ timeoutInMilliseconds, chunks, renderMetadata, }) => {
|
|
6
|
+
const makeTimeoutError = ({ timeoutInMilliseconds, chunks, renderMetadata, renderId, }) => {
|
|
7
7
|
const availableChunks = chunks.map((c) => (0, parse_chunk_key_1.parseLambdaChunkKey)(c.Key));
|
|
8
8
|
const missingChunks = new Array(renderMetadata.totalChunks)
|
|
9
9
|
.fill(true)
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
.map((_, i) => i)
|
|
11
|
+
.filter((index) => {
|
|
12
|
+
return !availableChunks.find((c) => c.chunk === index);
|
|
13
|
+
});
|
|
14
14
|
const message = (0, make_timeout_message_1.makeTimeoutMessage)({
|
|
15
15
|
missingChunks,
|
|
16
16
|
renderMetadata,
|
|
17
17
|
timeoutInMilliseconds,
|
|
18
|
+
renderId,
|
|
18
19
|
});
|
|
19
20
|
return {
|
|
20
21
|
attempt: 1,
|
|
21
22
|
chunk: null,
|
|
22
|
-
explanation:
|
|
23
|
+
explanation: null,
|
|
23
24
|
frame: null,
|
|
24
25
|
isFatal: true,
|
|
25
26
|
s3Location: '',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RenderMetadata } from '../../defaults';
|
|
2
|
-
export declare const makeTimeoutMessage: ({ timeoutInMilliseconds, missingChunks, renderMetadata, }: {
|
|
2
|
+
export declare const makeTimeoutMessage: ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, }: {
|
|
3
3
|
timeoutInMilliseconds: number;
|
|
4
4
|
missingChunks: number[];
|
|
5
5
|
renderMetadata: RenderMetadata;
|
|
6
|
+
renderId: string;
|
|
6
7
|
}) => string;
|
|
@@ -1,31 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeTimeoutMessage = void 0;
|
|
4
|
+
const defaults_1 = require("../../defaults");
|
|
4
5
|
const docs_url_1 = require("../../shared/docs-url");
|
|
6
|
+
const get_aws_urls_1 = require("../../shared/get-aws-urls");
|
|
7
|
+
const get_current_region_1 = require("./get-current-region");
|
|
8
|
+
const MAX_MISSING_CHUNKS = 5;
|
|
5
9
|
const makeChunkMissingMessage = ({ missingChunks, renderMetadata, }) => {
|
|
6
|
-
|
|
7
|
-
.map((ch) => {
|
|
8
|
-
const isLastChunk = ch === renderMetadata.totalChunks - 1;
|
|
9
|
-
const start = ch * renderMetadata.framesPerLambda;
|
|
10
|
-
const end = isLastChunk
|
|
11
|
-
? renderMetadata.frameRange[1]
|
|
12
|
-
: (ch + 1) * renderMetadata.framesPerLambda - 1;
|
|
13
|
-
return `Chunk ${ch} (Frames ${start} - ${end})`;
|
|
14
|
-
})
|
|
15
|
-
.slice(0, 5);
|
|
16
|
-
if (missingChunksMessageList.length === 0) {
|
|
10
|
+
if (missingChunks.length === 0) {
|
|
17
11
|
return 'All chunks have been successfully rendered, but the main function has timed out.';
|
|
18
12
|
}
|
|
19
|
-
return
|
|
13
|
+
return [
|
|
14
|
+
`The following chunks are missing (showing ${Math.min(MAX_MISSING_CHUNKS, missingChunks.length)} out of ${missingChunks.length}):`,
|
|
15
|
+
...missingChunks
|
|
16
|
+
.map((ch) => {
|
|
17
|
+
const isLastChunk = ch === renderMetadata.totalChunks - 1;
|
|
18
|
+
const start = ch * renderMetadata.framesPerLambda;
|
|
19
|
+
const end = isLastChunk
|
|
20
|
+
? renderMetadata.frameRange[1]
|
|
21
|
+
: (ch + 1) * renderMetadata.framesPerLambda - 1;
|
|
22
|
+
const msg = `Chunk ${ch} (Frames ${start} - ${end})`;
|
|
23
|
+
return [
|
|
24
|
+
msg,
|
|
25
|
+
`▸ Logs for chunk ${ch}: ${(0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
26
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
27
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
28
|
+
rendererFunctionName: null,
|
|
29
|
+
renderId: renderMetadata.renderId,
|
|
30
|
+
chunk: ch,
|
|
31
|
+
})}`,
|
|
32
|
+
].join('\n');
|
|
33
|
+
})
|
|
34
|
+
.slice(0, 5),
|
|
35
|
+
].join('\n');
|
|
20
36
|
};
|
|
21
|
-
const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetadata, }) => {
|
|
37
|
+
const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, }) => {
|
|
38
|
+
const cloudWatchRendererUrl = (0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
39
|
+
renderId,
|
|
40
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
41
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
42
|
+
rendererFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
43
|
+
chunk: null,
|
|
44
|
+
});
|
|
45
|
+
const cloudWatchLaunchUrl = (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
46
|
+
renderId,
|
|
47
|
+
functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
48
|
+
method: defaults_1.LambdaRoutines.launch,
|
|
49
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
50
|
+
rendererFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
51
|
+
});
|
|
22
52
|
const message = [
|
|
23
53
|
`The main function timed out after ${timeoutInMilliseconds}ms.`,
|
|
24
|
-
`Consider increasing the timeout of your function.`,
|
|
25
54
|
makeChunkMissingMessage({ missingChunks, renderMetadata }),
|
|
26
|
-
|
|
55
|
+
'',
|
|
56
|
+
`Consider increasing the timeout of your function.`,
|
|
57
|
+
`▸ You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
|
|
27
58
|
`${docs_url_1.DOCS_URL}/docs/lambda/cli/functions#deploy`,
|
|
28
|
-
'
|
|
59
|
+
'',
|
|
60
|
+
'▸ Visit the logs for the main function:',
|
|
61
|
+
cloudWatchLaunchUrl,
|
|
62
|
+
'▸ Visit the logs for the renderer functions:',
|
|
63
|
+
cloudWatchRendererUrl,
|
|
64
|
+
'',
|
|
65
|
+
'▸ Get help on debugging this error:',
|
|
29
66
|
`${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/debug`,
|
|
30
67
|
].join('\n');
|
|
31
68
|
return message;
|
package/dist/functions/index.js
CHANGED
|
@@ -33,6 +33,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
33
33
|
inputProps: JSON.stringify(params.inputProps),
|
|
34
34
|
isWarm,
|
|
35
35
|
});
|
|
36
|
+
renderer_1.RenderInternals.setLogLevel(params.logLevel);
|
|
36
37
|
const renderIdDetermined = {
|
|
37
38
|
type: 'render-id-determined',
|
|
38
39
|
renderId,
|
|
@@ -52,6 +53,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
52
53
|
inputProps: JSON.stringify(params.inputProps),
|
|
53
54
|
isWarm,
|
|
54
55
|
});
|
|
56
|
+
renderer_1.RenderInternals.setLogLevel(params.logLevel);
|
|
55
57
|
const response = await (0, start_1.startHandler)(params, {
|
|
56
58
|
expectedBucketOwner: currentUserId,
|
|
57
59
|
});
|
|
@@ -65,6 +67,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
65
67
|
inputProps: JSON.stringify(params.inputProps),
|
|
66
68
|
isWarm,
|
|
67
69
|
});
|
|
70
|
+
renderer_1.RenderInternals.setLogLevel(params.logLevel);
|
|
68
71
|
const response = await (0, launch_1.launchHandler)(params, {
|
|
69
72
|
expectedBucketOwner: currentUserId,
|
|
70
73
|
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
@@ -94,6 +97,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
94
97
|
resolvedProps: JSON.stringify(params.resolvedProps),
|
|
95
98
|
isWarm,
|
|
96
99
|
});
|
|
100
|
+
renderer_1.RenderInternals.setLogLevel(params.logLevel);
|
|
97
101
|
const response = await (0, renderer_2.rendererHandler)(params, {
|
|
98
102
|
expectedBucketOwner: currentUserId,
|
|
99
103
|
isWarm,
|
|
@@ -137,5 +141,12 @@ const routine = async (params, responseStream, context) => {
|
|
|
137
141
|
responseStream.write(JSON.stringify(res));
|
|
138
142
|
responseStream.end();
|
|
139
143
|
}
|
|
144
|
+
finally {
|
|
145
|
+
responseStream.on('close', () => {
|
|
146
|
+
if (!process.env.VITEST) {
|
|
147
|
+
process.exit(0);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
140
151
|
};
|
|
141
152
|
exports.handler = (0, streamify_response_1.streamifyResponse)(routine);
|
package/dist/functions/launch.js
CHANGED
|
@@ -24,12 +24,13 @@ 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");
|
|
27
28
|
const renderer_1 = require("@remotion/renderer");
|
|
28
29
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
29
30
|
const node_path_1 = require("node:path");
|
|
30
31
|
const remotion_1 = require("remotion");
|
|
31
32
|
const version_1 = require("remotion/version");
|
|
32
|
-
const
|
|
33
|
+
const aws_clients_1 = require("../shared/aws-clients");
|
|
33
34
|
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
34
35
|
const compress_props_1 = require("../shared/compress-props");
|
|
35
36
|
const constants_1 = require("../shared/constants");
|
|
@@ -58,14 +59,11 @@ const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
|
58
59
|
const write_post_render_data_1 = require("./helpers/write-post-render-data");
|
|
59
60
|
const callFunctionWithRetry = async ({ payload, retries, functionName, }) => {
|
|
60
61
|
try {
|
|
61
|
-
await (0,
|
|
62
|
-
|
|
63
|
-
payload,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
receivedStreamingPayload: () => undefined,
|
|
67
|
-
timeoutInTest: 120000,
|
|
68
|
-
});
|
|
62
|
+
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
63
|
+
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
64
|
+
Payload: JSON.stringify(payload),
|
|
65
|
+
InvocationType: 'Event',
|
|
66
|
+
}));
|
|
69
67
|
}
|
|
70
68
|
catch (err) {
|
|
71
69
|
if (err.name === 'ResourceConflictException') {
|
|
@@ -89,7 +89,10 @@ const renderHandler = async (params, options, logs) => {
|
|
|
89
89
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
90
90
|
framesRendered: renderedFrames,
|
|
91
91
|
renderId: params.renderId,
|
|
92
|
-
}).catch((err) =>
|
|
92
|
+
}).catch((err) => {
|
|
93
|
+
console.log(err);
|
|
94
|
+
return reject(err);
|
|
95
|
+
});
|
|
93
96
|
}
|
|
94
97
|
const allFrames = renderer_1.RenderInternals.getFramesToRender(params.frameRange, params.everyNthFrame);
|
|
95
98
|
if (renderedFrames === allFrames.length) {
|
|
@@ -181,6 +184,8 @@ const renderHandler = async (params, options, logs) => {
|
|
|
181
184
|
...chunkTimingData,
|
|
182
185
|
timings: Object.values(chunkTimingData.timings),
|
|
183
186
|
};
|
|
187
|
+
renderer_1.RenderInternals.Log.verbose('Writing chunk to S3');
|
|
188
|
+
const writeStart = Date.now();
|
|
184
189
|
await (0, io_1.lambdaWriteFile)({
|
|
185
190
|
bucketName: params.bucketName,
|
|
186
191
|
key: (0, constants_1.chunkKeyForIndex)({
|
|
@@ -194,6 +199,10 @@ const renderHandler = async (params, options, logs) => {
|
|
|
194
199
|
downloadBehavior: null,
|
|
195
200
|
customCredentials: null,
|
|
196
201
|
});
|
|
202
|
+
renderer_1.RenderInternals.Log.verbose('Wrote chunk to S3', {
|
|
203
|
+
time: Date.now() - writeStart,
|
|
204
|
+
});
|
|
205
|
+
renderer_1.RenderInternals.Log.verbose('Cleaning up and writing timings');
|
|
197
206
|
await Promise.all([
|
|
198
207
|
node_fs_1.default.promises.rm(outputLocation, { recursive: true }),
|
|
199
208
|
node_fs_1.default.promises.rm(outputPath, { recursive: true }),
|
package/dist/functions/start.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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");
|
|
4
5
|
const version_1 = require("remotion/version");
|
|
5
6
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
6
|
-
const
|
|
7
|
+
const aws_clients_1 = require("../shared/aws-clients");
|
|
7
8
|
const constants_1 = require("../shared/constants");
|
|
8
9
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
9
10
|
const random_hash_1 = require("../shared/random-hash");
|
|
@@ -77,14 +78,12 @@ const startHandler = async (params, options) => {
|
|
|
77
78
|
rendererFunctionName: params.rendererFunctionName,
|
|
78
79
|
audioCodec: params.audioCodec,
|
|
79
80
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
timeoutInTest: 120000,
|
|
87
|
-
});
|
|
81
|
+
// Don't replace with callLambda(), we want to return before the render is snone
|
|
82
|
+
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
83
|
+
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
84
|
+
Payload: JSON.stringify(payload),
|
|
85
|
+
InvocationType: 'Event',
|
|
86
|
+
}));
|
|
88
87
|
await initialFile;
|
|
89
88
|
return {
|
|
90
89
|
type: 'success',
|
|
@@ -7,7 +7,6 @@ const aws_clients_1 = require("./aws-clients");
|
|
|
7
7
|
const callLambda = async ({ functionName, type, payload, region, receivedStreamingPayload, timeoutInTest, }) => {
|
|
8
8
|
const res = await (0, aws_clients_1.getLambdaClient)(region, timeoutInTest).send(new client_lambda_1.InvokeWithResponseStreamCommand({
|
|
9
9
|
FunctionName: functionName,
|
|
10
|
-
// @ts-expect-error
|
|
11
10
|
Payload: JSON.stringify({ type, ...payload }),
|
|
12
11
|
}));
|
|
13
12
|
const events = res.EventStream;
|
|
@@ -28,7 +27,11 @@ const callLambda = async ({ functionName, type, payload, region, receivedStreami
|
|
|
28
27
|
}
|
|
29
28
|
if (event.InvokeComplete) {
|
|
30
29
|
if (event.InvokeComplete.ErrorCode) {
|
|
31
|
-
|
|
30
|
+
const logs = `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
|
|
31
|
+
if (event.InvokeComplete.ErrorCode === 'Unhandled') {
|
|
32
|
+
throw new Error(`Lambda function ${functionName} failed with an unhandled error. See ${logs} to see the logs of this invocation.`);
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}. See ${logs} to see the logs of this invocation.`);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const encodeAwsUrlParams: (input: string) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeAwsUrlParams = void 0;
|
|
4
|
+
const encodeAwsUrlParams = (input) => {
|
|
5
|
+
return encodeURIComponent(input).replace(/%/g, '$25');
|
|
6
|
+
};
|
|
7
|
+
exports.encodeAwsUrlParams = encodeAwsUrlParams;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { AwsRegion } from '../client';
|
|
2
2
|
import type { LambdaRoutines } from './constants';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getCloudwatchMethodUrl: ({ region, functionName, renderId, rendererFunctionName, method, }: {
|
|
4
4
|
region: AwsRegion;
|
|
5
5
|
functionName: string;
|
|
6
|
-
rendererFunctionName: string | null;
|
|
7
6
|
method: LambdaRoutines;
|
|
7
|
+
rendererFunctionName: string | null;
|
|
8
|
+
renderId: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
export declare const getCloudwatchRendererUrl: ({ region, functionName, renderId, rendererFunctionName, chunk, }: {
|
|
11
|
+
region: AwsRegion;
|
|
12
|
+
functionName: string;
|
|
13
|
+
rendererFunctionName: string | null;
|
|
8
14
|
renderId: string;
|
|
15
|
+
chunk: null | number;
|
|
9
16
|
}) => string;
|
|
10
17
|
export declare const getS3RenderUrl: ({ renderId, region, bucketName, }: {
|
|
11
18
|
renderId: string;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getS3RenderUrl = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.getS3RenderUrl = exports.getCloudwatchRendererUrl = exports.getCloudwatchMethodUrl = void 0;
|
|
4
|
+
const encode_aws_url_params_1 = require("./encode-aws-url-params");
|
|
5
|
+
const getCloudwatchMethodUrl = ({ region, functionName, renderId, rendererFunctionName, method, }) => {
|
|
5
6
|
const functionNameToUse = rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : functionName;
|
|
6
|
-
|
|
7
|
+
const query = `"method=${method},renderId=${renderId}"`;
|
|
8
|
+
return cloudWatchUrlWithQuery({ region, functionNameToUse, query });
|
|
9
|
+
};
|
|
10
|
+
exports.getCloudwatchMethodUrl = getCloudwatchMethodUrl;
|
|
11
|
+
const getCloudwatchRendererUrl = ({ region, functionName, renderId, rendererFunctionName, chunk, }) => {
|
|
12
|
+
const functionNameToUse = rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : functionName;
|
|
13
|
+
const query = `"method=renderer,renderId=${renderId}${chunk === null ? '' : `,chunk=${chunk},`}"`;
|
|
14
|
+
return cloudWatchUrlWithQuery({ region, functionNameToUse, query });
|
|
15
|
+
};
|
|
16
|
+
exports.getCloudwatchRendererUrl = getCloudwatchRendererUrl;
|
|
17
|
+
const cloudWatchUrlWithQuery = ({ region, functionNameToUse, query, }) => {
|
|
18
|
+
return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${(0, encode_aws_url_params_1.encodeAwsUrlParams)(query)}`;
|
|
7
19
|
};
|
|
8
|
-
exports.getCloudwatchStreamUrl = getCloudwatchStreamUrl;
|
|
9
20
|
const getS3RenderUrl = ({ renderId, region, bucketName, }) => {
|
|
10
21
|
return `https://s3.console.aws.amazon.com/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
|
|
11
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"url": "https://github.com/JonnyBurger/remotion"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@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.370.0",
|
|
17
|
+
"@aws-sdk/client-cloudwatch-logs": "3.370.0",
|
|
18
|
+
"@aws-sdk/client-iam": "3.370.0",
|
|
19
|
+
"@aws-sdk/client-lambda": "3.370.0",
|
|
20
|
+
"@aws-sdk/client-s3": "3.370.0",
|
|
21
|
+
"@aws-sdk/client-service-quotas": "3.370.0",
|
|
22
|
+
"@aws-sdk/client-sts": "3.370.0",
|
|
23
|
+
"@aws-sdk/credential-providers": "3.370.0",
|
|
24
|
+
"@aws-sdk/lib-storage": "3.370.0",
|
|
25
|
+
"@aws-sdk/s3-request-presigner": "3.370.0",
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
|
-
"remotion": "4.0.
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/renderer": "4.0.
|
|
31
|
-
"
|
|
28
|
+
"@remotion/bundler": "4.0.7",
|
|
29
|
+
"@remotion/cli": "4.0.7",
|
|
30
|
+
"@remotion/renderer": "4.0.7",
|
|
31
|
+
"remotion": "4.0.7"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
46
|
"zod": "3.21.4",
|
|
47
|
-
"@remotion/bundler": "4.0.
|
|
48
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
47
|
+
"@remotion/bundler": "4.0.7",
|
|
48
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.7"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.7"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
package/remotionlambda-x64.zip
DELETED
|
Binary file
|