@remotion/lambda 4.0.5 → 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/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 +4 -2
- package/dist/api/render-still-on-lambda.d.ts +5 -1
- package/dist/api/render-still-on-lambda.js +18 -3
- 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 +9 -3
- package/dist/client.d.ts +4 -1
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/compositions.d.ts +1 -0
- package/dist/functions/compositions.js +2 -1
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-progress.js +8 -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/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 +44 -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 +7 -4
- package/dist/functions/renderer.d.ts +3 -1
- package/dist/functions/renderer.js +26 -10
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +2 -1
- 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 +30 -13
- package/dist/shared/compress-props.js +1 -1
- package/dist/shared/constants.d.ts +1 -0
- 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/get-function-version.js +2 -0
- package/dist/shared/invoke-webhook.d.ts +2 -0
- package/dist/shared/return-values.d.ts +5 -5
- package/package.json +20 -19
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
|
@@ -2,12 +2,11 @@
|
|
|
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
|
-
// @ts-expect-error
|
|
11
10
|
Payload: JSON.stringify({ type, ...payload }),
|
|
12
11
|
}));
|
|
13
12
|
const events = res.EventStream;
|
|
@@ -19,30 +18,48 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
|
19
18
|
if (event.PayloadChunk) {
|
|
20
19
|
// Decode the raw bytes into a string a human can read
|
|
21
20
|
const decoded = new TextDecoder('utf-8').decode(event.PayloadChunk.Payload);
|
|
21
|
+
const streamPayload = (0, streaming_payloads_1.isStreamingPayload)(decoded);
|
|
22
|
+
if (streamPayload) {
|
|
23
|
+
receivedStreamingPayload(streamPayload);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
22
26
|
responsePayload = Buffer.concat([responsePayload, Buffer.from(decoded)]);
|
|
23
27
|
}
|
|
24
28
|
if (event.InvokeComplete) {
|
|
25
29
|
if (event.InvokeComplete.ErrorCode) {
|
|
26
|
-
|
|
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.`);
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
const string = Buffer.from(responsePayload).toString();
|
|
31
|
-
const json =
|
|
39
|
+
const json = parseJson(string);
|
|
40
|
+
return json;
|
|
41
|
+
};
|
|
42
|
+
exports.callLambda = callLambda;
|
|
43
|
+
const parseJson = (input) => {
|
|
44
|
+
var _a;
|
|
45
|
+
let json = JSON.parse(input);
|
|
46
|
+
if ('statusCode' in json) {
|
|
47
|
+
json = JSON.parse(json.body);
|
|
48
|
+
}
|
|
32
49
|
if ('errorMessage' in json) {
|
|
33
50
|
const err = new Error(json.errorMessage);
|
|
34
51
|
err.name = json.errorType;
|
|
35
52
|
err.stack = ((_a = json.trace) !== null && _a !== void 0 ? _a : []).join('\n');
|
|
36
53
|
throw err;
|
|
37
54
|
}
|
|
38
|
-
//
|
|
55
|
+
// This will not happen, it is for narrowing purposes
|
|
39
56
|
if ('statusCode' in json) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
throw new Error(`Lambda function failed with status code ${json.statusCode}`);
|
|
58
|
+
}
|
|
59
|
+
if (json.type === 'error') {
|
|
60
|
+
const err = new Error(json.message);
|
|
61
|
+
err.stack = json.stack;
|
|
62
|
+
throw err;
|
|
44
63
|
}
|
|
45
|
-
// Non-streaming: 3.3.95 and below
|
|
46
64
|
return json;
|
|
47
65
|
};
|
|
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";
|
|
@@ -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
|
};
|
|
@@ -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.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/bundler": "4.0.
|
|
29
|
-
"@remotion/cli": "4.0.
|
|
30
|
-
"@remotion/renderer": "4.0.
|
|
31
|
-
"remotion": "4.0.
|
|
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",
|
|
@@ -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.7",
|
|
48
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.7"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.7"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
package/remotionlambda-x64.zip
DELETED
|
Binary file
|