@remotion/lambda 4.0.66 → 4.0.67
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/functions/helpers/get-browser-instance.js +4 -4
- package/dist/functions/helpers/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/leak-detection.js +40 -0
- package/dist/functions/helpers/request-context.d.ts +5 -0
- package/dist/functions/helpers/request-context.js +2 -0
- package/dist/functions/index.js +5 -1
- package/dist/functions/renderer.d.ts +2 -1
- package/dist/functions/renderer.js +3 -15
- package/dist/shared/why-is-node-running.d.ts +1 -1
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
|
@@ -21,10 +21,10 @@ const waitForLaunched = () => {
|
|
|
21
21
|
return new Promise((resolve, reject) => {
|
|
22
22
|
const check = () => setTimeout(() => {
|
|
23
23
|
if (launching) {
|
|
24
|
-
|
|
24
|
+
check();
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
27
|
+
resolve();
|
|
28
28
|
}
|
|
29
29
|
}, 16);
|
|
30
30
|
setTimeout(() => reject(new Error('Timeout launching browser')), 5000);
|
|
@@ -32,7 +32,7 @@ const waitForLaunched = () => {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
const forgetBrowserEventLoop = (logLevel) => {
|
|
35
|
-
renderer_1.RenderInternals.Log.
|
|
35
|
+
renderer_1.RenderInternals.Log.infoAdvanced({ indent: false, logLevel }, 'Keeping browser open for next invocation');
|
|
36
36
|
_browserInstance === null || _browserInstance === void 0 ? void 0 : _browserInstance.instance.forgetEventLoop();
|
|
37
37
|
};
|
|
38
38
|
exports.forgetBrowserEventLoop = forgetBrowserEventLoop;
|
|
@@ -43,6 +43,7 @@ const getBrowserInstance = async (logLevel, indent, chromiumOptions) => {
|
|
|
43
43
|
// Override the `null` value, which might come from CLI with swANGLE
|
|
44
44
|
gl: (_a = chromiumOptions.gl) !== null && _a !== void 0 ? _a : 'swangle',
|
|
45
45
|
};
|
|
46
|
+
const configurationString = makeConfigurationString(actualChromiumOptions, logLevel);
|
|
46
47
|
if (launching) {
|
|
47
48
|
renderer_1.RenderInternals.Log.info('Already waiting for browser launch...');
|
|
48
49
|
await waitForLaunched();
|
|
@@ -50,7 +51,6 @@ const getBrowserInstance = async (logLevel, indent, chromiumOptions) => {
|
|
|
50
51
|
throw new Error('expected to launch');
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
const configurationString = makeConfigurationString(actualChromiumOptions, logLevel);
|
|
54
54
|
if (!_browserInstance) {
|
|
55
55
|
renderer_1.RenderInternals.Log.info('Cold Lambda function, launching new Lambda function');
|
|
56
56
|
launching = true;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeIntrospection } from '../../shared/why-is-node-running';
|
|
2
|
+
export declare const stopLeakDetection: () => void;
|
|
3
|
+
export declare const setCurrentRequestId: (awsRequestId: string) => void;
|
|
4
|
+
export declare const startLeakDetection: (leakDetection: NodeIntrospection, awsRequestId: string) => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startLeakDetection = exports.setCurrentRequestId = exports.stopLeakDetection = void 0;
|
|
4
|
+
const why_is_node_running_1 = require("../../shared/why-is-node-running");
|
|
5
|
+
let currentRequestId = null;
|
|
6
|
+
let leakDetectionTimeout = null;
|
|
7
|
+
const stopLeakDetection = () => {
|
|
8
|
+
if (leakDetectionTimeout !== null) {
|
|
9
|
+
clearTimeout(leakDetectionTimeout.timeout);
|
|
10
|
+
leakDetectionTimeout = null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.stopLeakDetection = stopLeakDetection;
|
|
14
|
+
const setCurrentRequestId = (awsRequestId) => {
|
|
15
|
+
currentRequestId = awsRequestId;
|
|
16
|
+
};
|
|
17
|
+
exports.setCurrentRequestId = setCurrentRequestId;
|
|
18
|
+
const startLeakDetection = (leakDetection, awsRequestId) => {
|
|
19
|
+
currentRequestId = awsRequestId;
|
|
20
|
+
leakDetectionTimeout = {
|
|
21
|
+
awsRequestId,
|
|
22
|
+
timeout: setTimeout(() => {
|
|
23
|
+
// First allow request ID to be set
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
if (currentRequestId !== awsRequestId) {
|
|
26
|
+
// New function, all good
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.log('Leak detected: Lambda function is still running 10s after the render has finished.');
|
|
30
|
+
console.log('You may report this to the Remotion team.');
|
|
31
|
+
console.log('Include the logs below:');
|
|
32
|
+
(0, why_is_node_running_1.whyIsNodeRunning)(leakDetection);
|
|
33
|
+
console.log('Force-quitting the Lambda function now.');
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}, 100);
|
|
36
|
+
}, 10000),
|
|
37
|
+
};
|
|
38
|
+
leakDetectionTimeout.timeout.unref();
|
|
39
|
+
};
|
|
40
|
+
exports.startLeakDetection = startLeakDetection;
|
package/dist/functions/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const constants_1 = require("../shared/constants");
|
|
|
6
6
|
const compositions_1 = require("./compositions");
|
|
7
7
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
8
8
|
const is_warm_1 = require("./helpers/is-warm");
|
|
9
|
+
const leak_detection_1 = require("./helpers/leak-detection");
|
|
9
10
|
const lifecycle_1 = require("./helpers/lifecycle");
|
|
10
11
|
const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
|
|
11
12
|
const streamify_response_1 = require("./helpers/streamify-response");
|
|
@@ -18,8 +19,11 @@ const renderer_2 = require("./renderer");
|
|
|
18
19
|
const start_1 = require("./start");
|
|
19
20
|
const still_1 = require("./still");
|
|
20
21
|
const innerHandler = async (params, responseStream, context) => {
|
|
22
|
+
(0, leak_detection_1.setCurrentRequestId)(context.awsRequestId);
|
|
21
23
|
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
22
24
|
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
25
|
+
console.log('AWS Request ID:', context.awsRequestId);
|
|
26
|
+
(0, leak_detection_1.stopLeakDetection)();
|
|
23
27
|
if (!(context === null || context === void 0 ? void 0 : context.invokedFunctionArn)) {
|
|
24
28
|
throw new Error('Lambda function unexpectedly does not have context.invokedFunctionArn');
|
|
25
29
|
}
|
|
@@ -108,7 +112,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
108
112
|
const response = await (0, renderer_2.rendererHandler)(params, {
|
|
109
113
|
expectedBucketOwner: currentUserId,
|
|
110
114
|
isWarm,
|
|
111
|
-
});
|
|
115
|
+
}, context);
|
|
112
116
|
responseStream.write(JSON.stringify(response), () => {
|
|
113
117
|
responseStream.end();
|
|
114
118
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { LambdaPayload } from '../shared/constants';
|
|
2
|
+
import type { RequestContext } from './helpers/request-context';
|
|
2
3
|
type Options = {
|
|
3
4
|
expectedBucketOwner: string;
|
|
4
5
|
isWarm: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const rendererHandler: (params: LambdaPayload, options: Options) => Promise<{
|
|
7
|
+
export declare const rendererHandler: (params: LambdaPayload, options: Options, requestContext: RequestContext) => Promise<{
|
|
7
8
|
type: 'success';
|
|
8
9
|
}>;
|
|
9
10
|
export {};
|
|
@@ -18,17 +18,13 @@ const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
|
18
18
|
const get_chromium_executable_path_1 = require("./helpers/get-chromium-executable-path");
|
|
19
19
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
20
20
|
const io_1 = require("./helpers/io");
|
|
21
|
+
const leak_detection_1 = require("./helpers/leak-detection");
|
|
21
22
|
const on_downloads_logger_1 = require("./helpers/on-downloads-logger");
|
|
22
23
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
23
|
-
let leakDetectionTimeout = null;
|
|
24
24
|
const renderHandler = async (params, options, logs) => {
|
|
25
25
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
26
26
|
throw new Error('Params must be renderer');
|
|
27
27
|
}
|
|
28
|
-
if (leakDetectionTimeout !== null) {
|
|
29
|
-
clearTimeout(leakDetectionTimeout);
|
|
30
|
-
leakDetectionTimeout = null;
|
|
31
|
-
}
|
|
32
28
|
if (params.launchFunctionConfig.version !== version_1.VERSION) {
|
|
33
29
|
throw new Error(`The version of the function that was specified as "rendererFunctionName" is ${version_1.VERSION} but the version of the function that invoked the render is ${params.launchFunctionConfig.version}. Please make sure that the version of the function that is specified as "rendererFunctionName" is the same as the version of the function that is invoked.`);
|
|
34
30
|
}
|
|
@@ -218,7 +214,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
218
214
|
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: params.logLevel }, 'Done!');
|
|
219
215
|
return {};
|
|
220
216
|
};
|
|
221
|
-
const rendererHandler = async (params, options) => {
|
|
217
|
+
const rendererHandler = async (params, options, requestContext) => {
|
|
222
218
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
223
219
|
throw new Error('Params must be renderer');
|
|
224
220
|
}
|
|
@@ -282,15 +278,7 @@ const rendererHandler = async (params, options) => {
|
|
|
282
278
|
}
|
|
283
279
|
finally {
|
|
284
280
|
(0, get_browser_instance_1.forgetBrowserEventLoop)(params.logLevel);
|
|
285
|
-
|
|
286
|
-
console.log('Leak detected: Lambda function is still running 10s after the render has finished.');
|
|
287
|
-
console.log('You may report this to the Remotion team.');
|
|
288
|
-
console.log('Include the logs below:');
|
|
289
|
-
(0, why_is_node_running_1.whyIsNodeRunning)(leakDetection);
|
|
290
|
-
console.log('Force-quitting the Lambda function now.');
|
|
291
|
-
process.exit(0);
|
|
292
|
-
}, 10000);
|
|
293
|
-
leakDetectionTimeout.unref();
|
|
281
|
+
(0, leak_detection_1.startLeakDetection)(leakDetection, requestContext.awsRequestId);
|
|
294
282
|
}
|
|
295
283
|
};
|
|
296
284
|
exports.rendererHandler = rendererHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.67",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.22.3",
|
|
29
|
-
"@remotion/bundler": "4.0.
|
|
30
|
-
"@remotion/cli": "4.0.
|
|
31
|
-
"remotion": "4.0.
|
|
32
|
-
"
|
|
29
|
+
"@remotion/bundler": "4.0.67",
|
|
30
|
+
"@remotion/cli": "4.0.67",
|
|
31
|
+
"@remotion/renderer": "4.0.67",
|
|
32
|
+
"remotion": "4.0.67"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.276",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"ts-node": "^10.8.0",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"@remotion/bundler": "4.0.
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
46
|
+
"@remotion/bundler": "4.0.67",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.67"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.67"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|