@remotion/lambda 4.0.255 → 4.0.256
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/__mocks__/clean-items.d.ts +2 -0
- package/dist/api/__mocks__/clean-items.js +24 -0
- package/dist/api/__mocks__/create-function.d.ts +2 -0
- package/dist/api/__mocks__/create-function.js +21 -0
- package/dist/api/__mocks__/delete-function.d.ts +2 -0
- package/dist/api/__mocks__/delete-function.js +9 -0
- package/dist/api/__mocks__/get-functions.d.ts +2 -0
- package/dist/api/__mocks__/get-functions.js +9 -0
- package/dist/api/__mocks__/upload-dir.d.ts +3 -0
- package/dist/api/__mocks__/upload-dir.js +47 -0
- package/dist/api/mock-functions.d.ts +18 -0
- package/dist/api/mock-functions.js +36 -0
- package/dist/cli/helpers/__mocks__/quit.d.ts +1 -0
- package/dist/cli/helpers/__mocks__/quit.js +7 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +7 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.js +17 -0
- package/dist/functions/chunk-optimization/types.d.ts +8 -0
- package/dist/functions/chunk-optimization/types.js +2 -0
- package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +3 -0
- package/dist/functions/helpers/__mocks__/get-browser-instance.js +12 -0
- package/dist/functions/helpers/__mocks__/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/__mocks__/leak-detection.js +9 -0
- package/dist/functions/helpers/__mocks__/timer.d.ts +2 -0
- package/dist/functions/helpers/__mocks__/timer.js +10 -0
- package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +1 -0
- package/dist/functions/helpers/best-frames-per-lambda-param.js +17 -0
- package/dist/functions/helpers/calculate-chunk-times.d.ts +5 -0
- package/dist/functions/helpers/calculate-chunk-times.js +29 -0
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +15 -0
- package/dist/functions/helpers/calculate-price-from-bucket.js +30 -0
- package/dist/functions/helpers/can-concat-seamlessly.d.ts +3 -0
- package/dist/functions/helpers/can-concat-seamlessly.js +17 -0
- package/dist/functions/helpers/cleanup-props.d.ts +8 -0
- package/dist/functions/helpers/cleanup-props.js +23 -0
- package/dist/functions/helpers/concat-videos.d.ts +23 -0
- package/dist/functions/helpers/concat-videos.js +54 -0
- package/dist/functions/helpers/create-post-render-data.d.ts +17 -0
- package/dist/functions/helpers/create-post-render-data.js +67 -0
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +14 -0
- package/dist/functions/helpers/find-output-file-in-bucket.js +38 -0
- package/dist/functions/helpers/format-costs-info.d.ts +2 -0
- package/dist/functions/helpers/format-costs-info.js +23 -0
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +10 -0
- package/dist/functions/helpers/get-overall-progress-s3.js +24 -0
- package/dist/functions/helpers/get-overall-progress.d.ts +9 -0
- package/dist/functions/helpers/get-overall-progress.js +23 -0
- package/dist/functions/helpers/get-progress.d.ts +15 -0
- package/dist/functions/helpers/get-progress.js +254 -0
- package/dist/functions/helpers/get-retry-stats.d.ts +5 -0
- package/dist/functions/helpers/get-retry-stats.js +2 -0
- package/dist/functions/helpers/inspect-errors.d.ts +4 -0
- package/dist/functions/helpers/inspect-errors.js +39 -0
- package/dist/functions/helpers/is-warm.d.ts +2 -0
- package/dist/functions/helpers/is-warm.js +10 -0
- package/dist/functions/helpers/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/leak-detection.js +40 -0
- package/dist/functions/helpers/make-timeout-error.d.ts +10 -0
- package/dist/functions/helpers/make-timeout-error.js +31 -0
- package/dist/functions/helpers/make-timeout-message.d.ts +10 -0
- package/dist/functions/helpers/make-timeout-message.js +75 -0
- package/dist/functions/helpers/merge-chunks.d.ts +36 -0
- package/dist/functions/helpers/merge-chunks.js +84 -0
- package/dist/functions/helpers/min-max.d.ts +2 -0
- package/dist/functions/helpers/min-max.js +33 -0
- package/dist/functions/helpers/on-downloads-logger.d.ts +2 -0
- package/dist/functions/helpers/on-downloads-logger.js +29 -0
- package/dist/functions/helpers/overall-render-progress.d.ts +59 -0
- package/dist/functions/helpers/overall-render-progress.js +180 -0
- package/dist/functions/helpers/print-concurrency-curve.d.ts +1 -0
- package/dist/functions/helpers/print-concurrency-curve.js +8 -0
- package/dist/functions/helpers/print-logging-helper.d.ts +4 -0
- package/dist/functions/helpers/print-logging-helper.js +12 -0
- package/dist/functions/helpers/render-has-audio-video.d.ts +6 -0
- package/dist/functions/helpers/render-has-audio-video.js +21 -0
- package/dist/functions/helpers/request-context.d.ts +5 -0
- package/dist/functions/helpers/request-context.js +2 -0
- package/dist/functions/helpers/stream-renderer.d.ts +17 -0
- package/dist/functions/helpers/stream-renderer.js +148 -0
- package/dist/functions/launch.d.ts +10 -0
- package/dist/functions/launch.js +595 -0
- package/dist/functions/progress.d.ts +11 -0
- package/dist/functions/progress.js +51 -0
- package/dist/functions/renderer.d.ts +17 -0
- package/dist/functions/renderer.js +341 -0
- package/dist/functions/start.d.ts +13 -0
- package/dist/functions/start.js +112 -0
- package/dist/functions/still.d.ts +19 -0
- package/dist/functions/still.js +329 -0
- package/dist/shared/__mocks__/aws-clients.d.ts +2 -0
- package/dist/shared/__mocks__/aws-clients.js +62 -0
- package/dist/shared/__mocks__/bundle-site.d.ts +2 -0
- package/dist/shared/__mocks__/bundle-site.js +32 -0
- package/dist/shared/__mocks__/check-credentials.d.ts +1 -0
- package/dist/shared/__mocks__/check-credentials.js +5 -0
- package/dist/shared/__mocks__/get-account-id.d.ts +2 -0
- package/dist/shared/__mocks__/get-account-id.js +11 -0
- package/dist/shared/__mocks__/read-dir.d.ts +2 -0
- package/dist/shared/__mocks__/read-dir.js +13 -0
- package/dist/shared/call-lambda.d.ts +16 -0
- package/dist/shared/call-lambda.js +149 -0
- package/dist/shared/cleanup-serialized-input-props.d.ts +14 -0
- package/dist/shared/cleanup-serialized-input-props.js +34 -0
- package/dist/shared/docs-url.d.ts +1 -0
- package/dist/shared/docs-url.js +4 -0
- package/dist/shared/get-most-expensive-chunks.d.ts +8 -0
- package/dist/shared/get-most-expensive-chunks.js +28 -0
- package/dist/shared/invoke-webhook.d.ts +48 -0
- package/dist/shared/invoke-webhook.js +140 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +5 -0
- package/dist/shared/parse-lambda-timings-key.js +2 -0
- package/dist/shared/return-values.d.ts +16 -0
- package/dist/shared/return-values.js +2 -0
- package/dist/shared/stackback.d.ts +6 -0
- package/dist/shared/stackback.js +59 -0
- package/dist/shared/validate-download-behavior.d.ts +1 -0
- package/dist/shared/validate-download-behavior.js +21 -0
- package/dist/shared/validate-frames-per-lambda.d.ts +4 -0
- package/dist/shared/validate-frames-per-lambda.js +29 -0
- package/dist/shared/validate-privacy.d.ts +2 -0
- package/dist/shared/validate-privacy.js +14 -0
- package/dist/shared/validate.d.ts +4 -0
- package/dist/shared/validate.js +8 -0
- package/dist/shared/why-is-node-running.d.ts +15 -0
- package/dist/shared/why-is-node-running.js +88 -0
- package/package.json +12 -12
- package/remotionlambda-arm64.zip +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupSerializedResolvedProps = exports.cleanupSerializedInputProps = void 0;
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
|
+
const cleanupSerializedInputProps = async ({ serialized, region, providerSpecifics, forcePathStyle, }) => {
|
|
6
|
+
if (serialized.type === 'payload') {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
const time = Date.now();
|
|
10
|
+
await providerSpecifics.deleteFile({
|
|
11
|
+
bucketName: serialized.bucketName,
|
|
12
|
+
key: (0, client_1.inputPropsKey)(serialized.hash),
|
|
13
|
+
region,
|
|
14
|
+
customCredentials: null,
|
|
15
|
+
forcePathStyle,
|
|
16
|
+
});
|
|
17
|
+
return Date.now() - time;
|
|
18
|
+
};
|
|
19
|
+
exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
|
|
20
|
+
const cleanupSerializedResolvedProps = async ({ serialized, region, providerSpecifics, forcePathStyle, }) => {
|
|
21
|
+
if (serialized.type === 'payload') {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const time = Date.now();
|
|
25
|
+
await providerSpecifics.deleteFile({
|
|
26
|
+
bucketName: serialized.bucketName,
|
|
27
|
+
key: (0, client_1.resolvedPropsKey)(serialized.hash),
|
|
28
|
+
region,
|
|
29
|
+
customCredentials: null,
|
|
30
|
+
forcePathStyle,
|
|
31
|
+
});
|
|
32
|
+
return Date.now() - time;
|
|
33
|
+
};
|
|
34
|
+
exports.cleanupSerializedResolvedProps = cleanupSerializedResolvedProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DOCS_URL = "https://remotion.dev";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ParsedTiming } from './parse-lambda-timings-key';
|
|
2
|
+
export declare const OVERHEAD_TIME_PER_LAMBDA = 100;
|
|
3
|
+
export type ExpensiveChunk = {
|
|
4
|
+
chunk: number;
|
|
5
|
+
frameRange: [number, number];
|
|
6
|
+
timeInMilliseconds: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getMostExpensiveChunks: (parsedTimings: ParsedTiming[], framesPerLambda: number, firstFrame: number, lastFrame: number) => ExpensiveChunk[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMostExpensiveChunks = exports.OVERHEAD_TIME_PER_LAMBDA = void 0;
|
|
4
|
+
exports.OVERHEAD_TIME_PER_LAMBDA = 100;
|
|
5
|
+
const getMostExpensiveChunks = (parsedTimings, framesPerLambda, firstFrame, lastFrame) => {
|
|
6
|
+
const mostExpensiveChunks = parsedTimings
|
|
7
|
+
.slice(0)
|
|
8
|
+
.sort((a, b) => {
|
|
9
|
+
const durA = a.rendered - a.start;
|
|
10
|
+
const durB = b.rendered - b.start;
|
|
11
|
+
return durB - durA;
|
|
12
|
+
})
|
|
13
|
+
.slice(0, 5);
|
|
14
|
+
return mostExpensiveChunks.map((c) => {
|
|
15
|
+
const isLastChunk = c.chunk === parsedTimings.length - 1;
|
|
16
|
+
return {
|
|
17
|
+
timeInMilliseconds: c.rendered - c.start,
|
|
18
|
+
chunk: c.chunk,
|
|
19
|
+
frameRange: [
|
|
20
|
+
framesPerLambda * c.chunk + firstFrame,
|
|
21
|
+
isLastChunk
|
|
22
|
+
? lastFrame
|
|
23
|
+
: framesPerLambda * (c.chunk + 1) - 1 + firstFrame,
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.getMostExpensiveChunks = getMostExpensiveChunks;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LogLevel } from '@remotion/renderer';
|
|
2
|
+
import type { EnhancedErrorInfo } from '@remotion/serverless';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
import http from 'node:http';
|
|
5
|
+
import type { AfterRenderCost } from './constants';
|
|
6
|
+
/**
|
|
7
|
+
* @description Calculates cryptographically secure signature for webhooks using Hmac.
|
|
8
|
+
* @link https://remotion.dev/docs/lambda/webhooks#validate-webhooks
|
|
9
|
+
* @param payload Stringified request body to encode in the signature.
|
|
10
|
+
* @param secret User-provided webhook secret used to sign the request.
|
|
11
|
+
* @returns {string} Calculated signature
|
|
12
|
+
*/
|
|
13
|
+
export declare function calculateSignature(payload: string, secret: string | null): string;
|
|
14
|
+
type DynamicWebhookPayload = {
|
|
15
|
+
type: 'error';
|
|
16
|
+
errors: {
|
|
17
|
+
message: string;
|
|
18
|
+
name: string;
|
|
19
|
+
stack: string;
|
|
20
|
+
}[];
|
|
21
|
+
} | {
|
|
22
|
+
type: 'success';
|
|
23
|
+
lambdaErrors: EnhancedErrorInfo[];
|
|
24
|
+
outputUrl: string | undefined;
|
|
25
|
+
outputFile: string | undefined;
|
|
26
|
+
timeToFinish: number | undefined;
|
|
27
|
+
costs: AfterRenderCost;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'timeout';
|
|
30
|
+
};
|
|
31
|
+
export type WebhookPayload = {
|
|
32
|
+
renderId: string;
|
|
33
|
+
expectedBucketOwner: string;
|
|
34
|
+
bucketName: string;
|
|
35
|
+
customData: Record<string, unknown> | null;
|
|
36
|
+
} & DynamicWebhookPayload;
|
|
37
|
+
export declare const mockableHttpClients: {
|
|
38
|
+
http: typeof http.request;
|
|
39
|
+
https: typeof https.request;
|
|
40
|
+
};
|
|
41
|
+
type InvokeWebhookOptions = {
|
|
42
|
+
payload: WebhookPayload;
|
|
43
|
+
url: string;
|
|
44
|
+
secret: string | null;
|
|
45
|
+
redirectsSoFar: number;
|
|
46
|
+
};
|
|
47
|
+
export declare const invokeWebhook: (options: InvokeWebhookOptions, logLevel: LogLevel, retries?: number, errors?: number) => Promise<void>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.invokeWebhook = exports.mockableHttpClients = void 0;
|
|
30
|
+
exports.calculateSignature = calculateSignature;
|
|
31
|
+
const renderer_1 = require("@remotion/renderer");
|
|
32
|
+
const https_1 = __importDefault(require("https"));
|
|
33
|
+
const Crypto = __importStar(require("node:crypto"));
|
|
34
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
35
|
+
/**
|
|
36
|
+
* @description Calculates cryptographically secure signature for webhooks using Hmac.
|
|
37
|
+
* @link https://remotion.dev/docs/lambda/webhooks#validate-webhooks
|
|
38
|
+
* @param payload Stringified request body to encode in the signature.
|
|
39
|
+
* @param secret User-provided webhook secret used to sign the request.
|
|
40
|
+
* @returns {string} Calculated signature
|
|
41
|
+
*/
|
|
42
|
+
function calculateSignature(payload, secret) {
|
|
43
|
+
if (!secret) {
|
|
44
|
+
return 'NO_SECRET_PROVIDED';
|
|
45
|
+
}
|
|
46
|
+
const hmac = Crypto.createHmac('sha512', secret);
|
|
47
|
+
const signature = 'sha512=' + hmac.update(payload).digest('hex');
|
|
48
|
+
return signature;
|
|
49
|
+
}
|
|
50
|
+
exports.mockableHttpClients = {
|
|
51
|
+
http: node_http_1.default.request,
|
|
52
|
+
https: https_1.default.request,
|
|
53
|
+
};
|
|
54
|
+
// Don't handle 304 status code (Not Modified) as a redirect,
|
|
55
|
+
// since the browser will display the right page.
|
|
56
|
+
const redirectStatusCodes = [301, 302, 303, 307, 308];
|
|
57
|
+
const getWebhookClient = (url) => {
|
|
58
|
+
if (url.startsWith('https://')) {
|
|
59
|
+
return exports.mockableHttpClients.https;
|
|
60
|
+
}
|
|
61
|
+
if (url.startsWith('http://')) {
|
|
62
|
+
return exports.mockableHttpClients.http;
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Can only request URLs starting with http:// or https://');
|
|
65
|
+
};
|
|
66
|
+
function invokeWebhookRaw({ payload, secret, url, redirectsSoFar, }) {
|
|
67
|
+
const jsonPayload = JSON.stringify(payload);
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
const req = getWebhookClient(url)(url, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
'Content-Length': jsonPayload.length,
|
|
74
|
+
'X-Remotion-Mode': 'production',
|
|
75
|
+
'X-Remotion-Signature': calculateSignature(jsonPayload, secret),
|
|
76
|
+
'X-Remotion-Status': payload.type,
|
|
77
|
+
},
|
|
78
|
+
timeout: 5000,
|
|
79
|
+
}, (res) => {
|
|
80
|
+
if (res.statusCode && res.statusCode > 299) {
|
|
81
|
+
if (redirectStatusCodes.includes(res.statusCode)) {
|
|
82
|
+
if (!res.headers.location) {
|
|
83
|
+
reject(new Error(`Received a status code ${res.statusCode} but no "Location" header while calling ${res.headers.location}`));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (redirectsSoFar > 10) {
|
|
87
|
+
reject(new Error(`Too many redirects while downloading ${url}`));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
invokeWebhookRaw({
|
|
91
|
+
payload,
|
|
92
|
+
secret,
|
|
93
|
+
url: res.headers.location,
|
|
94
|
+
redirectsSoFar: redirectsSoFar + 1,
|
|
95
|
+
})
|
|
96
|
+
.then(resolve)
|
|
97
|
+
.catch(reject);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
reject(new Error(`Sent a webhook to ${url} but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
resolve();
|
|
104
|
+
});
|
|
105
|
+
req.write(jsonPayload, (err) => {
|
|
106
|
+
if (err) {
|
|
107
|
+
reject(err);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
req.end();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
req.on('error', (err) => {
|
|
114
|
+
reject(err);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function exponentialBackoff(errorCount) {
|
|
119
|
+
return 1000 * 2 ** (errorCount - 1);
|
|
120
|
+
}
|
|
121
|
+
const invokeWebhook = async (options, logLevel, retries = 2, errors = 0) => {
|
|
122
|
+
try {
|
|
123
|
+
await invokeWebhookRaw(options);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
if (retries === 0) {
|
|
127
|
+
throw err;
|
|
128
|
+
}
|
|
129
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, 'Could not send webhook due to error:');
|
|
130
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, err.stack);
|
|
131
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Retrying in ${exponentialBackoff(errors)}ms.`);
|
|
132
|
+
await new Promise((resolve) => {
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
resolve();
|
|
135
|
+
}, exponentialBackoff(errors));
|
|
136
|
+
});
|
|
137
|
+
return (0, exports.invokeWebhook)(options, logLevel, retries - 1, errors + 1);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
exports.invokeWebhook = invokeWebhook;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CloudProvider, compositionsHandler, infoHandler } from '@remotion/serverless';
|
|
2
|
+
import type { ServerlessRoutines } from '@remotion/serverless/client';
|
|
3
|
+
import type { launchHandler } from '../functions/launch';
|
|
4
|
+
import type { progressHandler } from '../functions/progress';
|
|
5
|
+
import type { rendererHandler } from '../functions/renderer';
|
|
6
|
+
import type { startHandler } from '../functions/start';
|
|
7
|
+
import type { stillHandler } from '../functions/still';
|
|
8
|
+
export interface LambdaReturnValues<Provider extends CloudProvider> {
|
|
9
|
+
[ServerlessRoutines.start]: ReturnType<typeof startHandler>;
|
|
10
|
+
[ServerlessRoutines.launch]: ReturnType<typeof launchHandler>;
|
|
11
|
+
[ServerlessRoutines.renderer]: ReturnType<typeof rendererHandler>;
|
|
12
|
+
[ServerlessRoutines.status]: ReturnType<typeof progressHandler<Provider>>;
|
|
13
|
+
[ServerlessRoutines.info]: ReturnType<typeof infoHandler<Provider>>;
|
|
14
|
+
[ServerlessRoutines.still]: ReturnType<typeof stillHandler>;
|
|
15
|
+
[ServerlessRoutines.compositions]: ReturnType<typeof compositionsHandler>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stackback = void 0;
|
|
4
|
+
function FormatStackTrace(error, frames) {
|
|
5
|
+
const lines = [];
|
|
6
|
+
try {
|
|
7
|
+
lines.push(error.toString());
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
try {
|
|
11
|
+
lines.push('<error: ' + e + '>');
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
lines.push('<error>');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (let i = 0; i < frames.length; i++) {
|
|
18
|
+
const frame = frames[i];
|
|
19
|
+
let line;
|
|
20
|
+
try {
|
|
21
|
+
line = frame.toString();
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
try {
|
|
25
|
+
line = '<error: ' + e + '>';
|
|
26
|
+
}
|
|
27
|
+
catch (_b) {
|
|
28
|
+
// Any code that reaches this point is seriously nasty!
|
|
29
|
+
line = '<error>';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lines.push(' at ' + line);
|
|
33
|
+
}
|
|
34
|
+
return lines.join('\n');
|
|
35
|
+
}
|
|
36
|
+
const stackback = (error) => {
|
|
37
|
+
// save original stacktrace
|
|
38
|
+
const save = Error.prepareStackTrace;
|
|
39
|
+
// replace capture with our function
|
|
40
|
+
Error.prepareStackTrace = function (err, trace) {
|
|
41
|
+
// cache stack frames so we don't have to get them again
|
|
42
|
+
// use a non-enumerable property
|
|
43
|
+
Object.defineProperty(err, '_sb_callsites', {
|
|
44
|
+
value: trace,
|
|
45
|
+
});
|
|
46
|
+
return (save || FormatStackTrace)(err, trace);
|
|
47
|
+
};
|
|
48
|
+
// force capture of the stack frames
|
|
49
|
+
// eslint-disable-next-line no-unused-expressions
|
|
50
|
+
error.stack;
|
|
51
|
+
// someone already asked for the stack so we can't do this trick
|
|
52
|
+
if (!error._sb_callsites) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
// return original capture function
|
|
56
|
+
Error.prepareStackTrace = save;
|
|
57
|
+
return error._sb_callsites;
|
|
58
|
+
};
|
|
59
|
+
exports.stackback = stackback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateDownloadBehavior: (downloadBehavior: unknown) => null | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDownloadBehavior = void 0;
|
|
4
|
+
const validateDownloadBehavior = (downloadBehavior) => {
|
|
5
|
+
if (downloadBehavior === null || downloadBehavior === undefined) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
if (typeof downloadBehavior !== 'object') {
|
|
9
|
+
throw new Error('downloadBehavior must be null or an object');
|
|
10
|
+
}
|
|
11
|
+
const behavior = downloadBehavior;
|
|
12
|
+
if (behavior.type !== 'download' && behavior.type !== 'play-in-browser') {
|
|
13
|
+
throw new Error('Download behavior must be either "download" or "play-in-browser"');
|
|
14
|
+
}
|
|
15
|
+
if (behavior.type === 'download') {
|
|
16
|
+
if (typeof behavior.fileName !== 'string' && behavior.fileName !== null) {
|
|
17
|
+
throw new Error('If "downloadBehavior.type" is "download", then fileName must be "null" or a string');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateDownloadBehavior = validateDownloadBehavior;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFramesPerLambda = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const validateFramesPerLambda = ({ framesPerLambda, durationInFrames, }) => {
|
|
6
|
+
if (framesPerLambda === null) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (framesPerLambda === undefined) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (typeof framesPerLambda !== 'number') {
|
|
13
|
+
throw new TypeError(`'framesPerLambda' needs to be a number, passed ${JSON.stringify(framesPerLambda)}`);
|
|
14
|
+
}
|
|
15
|
+
if (!Number.isFinite(framesPerLambda)) {
|
|
16
|
+
throw new TypeError(`'framesPerLambda' needs to be finite, passed ${framesPerLambda}`);
|
|
17
|
+
}
|
|
18
|
+
if (Number.isNaN(framesPerLambda)) {
|
|
19
|
+
throw new TypeError(`'framesPerLambda' needs to be NaN, passed ${framesPerLambda}`);
|
|
20
|
+
}
|
|
21
|
+
if (framesPerLambda % 1 !== 0) {
|
|
22
|
+
throw new TypeError(`'framesPerLambda' needs to be an integer, passed ${framesPerLambda}`);
|
|
23
|
+
}
|
|
24
|
+
const effectiveMinimum = Math.min(constants_1.MINIMUM_FRAMES_PER_LAMBDA, durationInFrames);
|
|
25
|
+
if (framesPerLambda < effectiveMinimum) {
|
|
26
|
+
throw new TypeError(`The framesPerLambda needs to be at least ${effectiveMinimum}, but is ${framesPerLambda}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.validateFramesPerLambda = validateFramesPerLambda;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePrivacy = validatePrivacy;
|
|
4
|
+
function validatePrivacy(privacy, allowPrivate) {
|
|
5
|
+
if (typeof privacy !== 'string') {
|
|
6
|
+
throw new TypeError('Privacy must be a string');
|
|
7
|
+
}
|
|
8
|
+
if (!allowPrivate && privacy === 'private') {
|
|
9
|
+
throw new TypeError('Privacy must be either "public" or "no-acl"');
|
|
10
|
+
}
|
|
11
|
+
if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
|
|
12
|
+
throw new TypeError('Privacy must be either "private", "public" or "no-acl"');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NoReactInternals } from 'remotion/no-react';
|
|
2
|
+
export declare const validateFps: typeof NoReactInternals.validateFps;
|
|
3
|
+
export declare const validateDimension: typeof NoReactInternals.validateDimension;
|
|
4
|
+
export declare const validateDurationInFrames: typeof NoReactInternals.validateDurationInFrames;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
|
|
4
|
+
/* eslint-disable prefer-destructuring */
|
|
5
|
+
const no_react_1 = require("remotion/no-react");
|
|
6
|
+
exports.validateFps = no_react_1.NoReactInternals.validateFps;
|
|
7
|
+
exports.validateDimension = no_react_1.NoReactInternals.validateDimension;
|
|
8
|
+
exports.validateDurationInFrames = no_react_1.NoReactInternals.validateDurationInFrames;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import asyncHooks from 'async_hooks';
|
|
2
|
+
type Resource = {
|
|
3
|
+
type: string;
|
|
4
|
+
stacks: NodeJS.CallSite[];
|
|
5
|
+
resource: {
|
|
6
|
+
hasRef?: () => boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type NodeIntrospection = {
|
|
10
|
+
hook: asyncHooks.AsyncHook | null;
|
|
11
|
+
active: Map<number, Resource>;
|
|
12
|
+
};
|
|
13
|
+
export declare const enableNodeIntrospection: (enabled: boolean) => NodeIntrospection;
|
|
14
|
+
export declare function whyIsNodeRunning({ active, hook }: NodeIntrospection): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.enableNodeIntrospection = void 0;
|
|
7
|
+
exports.whyIsNodeRunning = whyIsNodeRunning;
|
|
8
|
+
const async_hooks_1 = __importDefault(require("async_hooks"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const stackback_1 = require("./stackback");
|
|
12
|
+
const enableNodeIntrospection = (enabled) => {
|
|
13
|
+
const active = new Map();
|
|
14
|
+
if (!enabled) {
|
|
15
|
+
return {
|
|
16
|
+
active,
|
|
17
|
+
hook: null,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const hook = async_hooks_1.default.createHook({
|
|
21
|
+
init(asyncId, type, _triggerAsyncId, resource) {
|
|
22
|
+
if (type === 'TIMERWRAP' || type === 'PROMISE')
|
|
23
|
+
return;
|
|
24
|
+
if (type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST')
|
|
25
|
+
return;
|
|
26
|
+
const err = new Error('whatevs');
|
|
27
|
+
const stacks = (0, stackback_1.stackback)(err);
|
|
28
|
+
active.set(asyncId, { type, stacks, resource });
|
|
29
|
+
},
|
|
30
|
+
destroy(asyncId) {
|
|
31
|
+
active.delete(asyncId);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
hook.enable();
|
|
35
|
+
return { hook, active };
|
|
36
|
+
};
|
|
37
|
+
exports.enableNodeIntrospection = enableNodeIntrospection;
|
|
38
|
+
function whyIsNodeRunning({ active, hook }) {
|
|
39
|
+
if (!hook) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
hook.disable();
|
|
43
|
+
const activeResources = [...active.values()].filter((r) => {
|
|
44
|
+
if (typeof r.resource.hasRef === 'function' && !r.resource.hasRef())
|
|
45
|
+
return false;
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
console.error('There are %d handle(s) keeping the process running', activeResources.length);
|
|
49
|
+
function printStacks(o) {
|
|
50
|
+
const stacks = o.stacks.slice(1).filter((s) => {
|
|
51
|
+
const filename = s.getFileName();
|
|
52
|
+
return (filename &&
|
|
53
|
+
filename.indexOf(path_1.sep) > -1 &&
|
|
54
|
+
filename.indexOf('internal' + path_1.sep) !== 0);
|
|
55
|
+
});
|
|
56
|
+
console.error('');
|
|
57
|
+
console.error('# %s', o.type);
|
|
58
|
+
if (stacks[0]) {
|
|
59
|
+
let padding = '';
|
|
60
|
+
stacks.forEach((s) => {
|
|
61
|
+
const pad = (s.getFileName() + ':' + s.getLineNumber()).replace(/./g, ' ');
|
|
62
|
+
if (pad.length > padding.length)
|
|
63
|
+
padding = pad;
|
|
64
|
+
});
|
|
65
|
+
stacks.forEach((s) => {
|
|
66
|
+
const prefix = s.getFileName() + ':' + s.getLineNumber();
|
|
67
|
+
try {
|
|
68
|
+
const src = fs_1.default
|
|
69
|
+
.readFileSync(s.getFileName(), 'utf-8')
|
|
70
|
+
.split(/\n|\r\n/);
|
|
71
|
+
console.error(prefix +
|
|
72
|
+
padding.slice(prefix.length) +
|
|
73
|
+
' - ' +
|
|
74
|
+
src[s.getLineNumber() - 1].trim());
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
console.error(prefix + padding.slice(prefix.length));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.error('(unknown stack trace)');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (const o of activeResources) {
|
|
86
|
+
printStacks(o);
|
|
87
|
+
}
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/lambda",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.256",
|
|
7
7
|
"description": "Render Remotion videos on AWS Lambda",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"@smithy/abort-controller": "3.1.1",
|
|
23
23
|
"mime-types": "2.1.34",
|
|
24
24
|
"zod": "3.22.3",
|
|
25
|
-
"@remotion/bundler": "4.0.
|
|
26
|
-
"@remotion/
|
|
27
|
-
"@remotion/
|
|
28
|
-
"
|
|
29
|
-
"@remotion/studio-server": "4.0.
|
|
30
|
-
"remotion": "4.0.
|
|
31
|
-
"@remotion/streaming": "4.0.
|
|
25
|
+
"@remotion/bundler": "4.0.256",
|
|
26
|
+
"@remotion/serverless": "4.0.256",
|
|
27
|
+
"@remotion/cli": "4.0.256",
|
|
28
|
+
"remotion": "4.0.256",
|
|
29
|
+
"@remotion/studio-server": "4.0.256",
|
|
30
|
+
"@remotion/renderer": "4.0.256",
|
|
31
|
+
"@remotion/streaming": "4.0.256"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/express": "^5.0.0",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"next": "15.1.2",
|
|
41
41
|
"pureimage": "0.4.13",
|
|
42
42
|
"zip-lib": "^0.7.2",
|
|
43
|
-
"@remotion/
|
|
44
|
-
"@remotion/
|
|
45
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
43
|
+
"@remotion/bundler": "4.0.256",
|
|
44
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.256",
|
|
45
|
+
"@remotion/eslint-config-internal": "4.0.256"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@remotion/bundler": "4.0.
|
|
48
|
+
"@remotion/bundler": "4.0.256"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|