@remotion/lambda 4.0.254 → 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/cli/log.d.ts +4 -4
- 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,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamRendererFunctionWithRetry = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const serverless_1 = require("@remotion/serverless");
|
|
6
|
+
const client_1 = require("@remotion/serverless/client");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const call_lambda_1 = require("../../shared/call-lambda");
|
|
10
|
+
const streamRenderer = ({ payload, functionName, outdir, overallProgress, files, logLevel, onArtifact, providerSpecifics, }) => {
|
|
11
|
+
if (payload.type !== client_1.ServerlessRoutines.renderer) {
|
|
12
|
+
throw new Error('Expected renderer type');
|
|
13
|
+
}
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
const receivedStreamingPayload = ({ message }) => {
|
|
16
|
+
if (message.type === 'lambda-invoked') {
|
|
17
|
+
overallProgress.setLambdaInvoked(payload.chunk);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (message.type === 'frames-rendered') {
|
|
21
|
+
overallProgress.setFrames({
|
|
22
|
+
index: payload.chunk,
|
|
23
|
+
encoded: message.payload.encoded,
|
|
24
|
+
rendered: message.payload.rendered,
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (message.type === 'video-chunk-rendered') {
|
|
29
|
+
const filename = (0, path_1.join)(outdir, `chunk:${String(payload.chunk).padStart(8, '0')}:video`);
|
|
30
|
+
(0, fs_1.writeFileSync)(filename, message.payload);
|
|
31
|
+
files.push(filename);
|
|
32
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Received video chunk for chunk ${payload.chunk}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (message.type === 'audio-chunk-rendered') {
|
|
36
|
+
const filename = (0, path_1.join)(outdir, `chunk:${String(payload.chunk).padStart(8, '0')}:audio`);
|
|
37
|
+
(0, fs_1.writeFileSync)(filename, message.payload);
|
|
38
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Received audio chunk for chunk ${payload.chunk}`);
|
|
39
|
+
files.push(filename);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (message.type === 'chunk-complete') {
|
|
43
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Finished chunk ${payload.chunk}`);
|
|
44
|
+
overallProgress.addChunkCompleted(payload.chunk, message.payload.start, message.payload.rendered);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (message.type === 'artifact-emitted') {
|
|
48
|
+
const artifact = (0, serverless_1.deserializeArtifact)(message.payload.artifact);
|
|
49
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `Received artifact on frame ${message.payload.artifact.frame}:`, artifact.filename, artifact.content.length + 'bytes.');
|
|
50
|
+
const { alreadyExisted } = onArtifact(artifact);
|
|
51
|
+
if (alreadyExisted) {
|
|
52
|
+
return resolve({
|
|
53
|
+
type: 'error',
|
|
54
|
+
error: `Chunk ${payload.chunk} emitted an asset filename ${message.payload.artifact.filename} at frame ${message.payload.artifact.frame} but there is already another artifact with the same name. https://remotion.dev/docs/artifacts`,
|
|
55
|
+
shouldRetry: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (message.type === 'error-occurred') {
|
|
61
|
+
overallProgress.addErrorWithoutUpload(message.payload.errorInfo);
|
|
62
|
+
overallProgress.setFrames({
|
|
63
|
+
encoded: 0,
|
|
64
|
+
index: payload.chunk,
|
|
65
|
+
rendered: 0,
|
|
66
|
+
});
|
|
67
|
+
renderer_1.RenderInternals.Log.error({
|
|
68
|
+
indent: false,
|
|
69
|
+
logLevel,
|
|
70
|
+
}, `Renderer function of chunk ${payload.chunk} failed with error: ${message.payload.error}`);
|
|
71
|
+
renderer_1.RenderInternals.Log.error({
|
|
72
|
+
indent: false,
|
|
73
|
+
logLevel,
|
|
74
|
+
}, `Will retry chunk = ${message.payload.shouldRetry}`);
|
|
75
|
+
resolve({
|
|
76
|
+
type: 'error',
|
|
77
|
+
error: message.payload.error,
|
|
78
|
+
shouldRetry: message.payload.shouldRetry,
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`Unknown message type ${message.type}`);
|
|
83
|
+
};
|
|
84
|
+
(0, call_lambda_1.callLambdaWithStreaming)({
|
|
85
|
+
functionName,
|
|
86
|
+
payload,
|
|
87
|
+
retriesRemaining: 1,
|
|
88
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
89
|
+
timeoutInTest: 12000,
|
|
90
|
+
type: client_1.ServerlessRoutines.renderer,
|
|
91
|
+
receivedStreamingPayload,
|
|
92
|
+
})
|
|
93
|
+
.then(() => {
|
|
94
|
+
resolve({
|
|
95
|
+
type: 'success',
|
|
96
|
+
});
|
|
97
|
+
})
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
const shouldRetry = (_b = (_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('Error: aborted')) !== null && _b !== void 0 ? _b : false;
|
|
101
|
+
resolve({
|
|
102
|
+
type: 'error',
|
|
103
|
+
error: err.stack,
|
|
104
|
+
shouldRetry,
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const streamRendererFunctionWithRetry = async ({ payload, files, functionName, outdir, overallProgress, logLevel, onArtifact, providerSpecifics, }) => {
|
|
110
|
+
if (payload.type !== client_1.ServerlessRoutines.renderer) {
|
|
111
|
+
throw new Error('Expected renderer type');
|
|
112
|
+
}
|
|
113
|
+
const result = await streamRenderer({
|
|
114
|
+
files,
|
|
115
|
+
functionName,
|
|
116
|
+
outdir,
|
|
117
|
+
overallProgress,
|
|
118
|
+
payload,
|
|
119
|
+
logLevel,
|
|
120
|
+
onArtifact,
|
|
121
|
+
providerSpecifics,
|
|
122
|
+
});
|
|
123
|
+
if (result.type === 'error') {
|
|
124
|
+
if (!result.shouldRetry) {
|
|
125
|
+
throw new Error(result.error);
|
|
126
|
+
}
|
|
127
|
+
overallProgress.addRetry({
|
|
128
|
+
attempt: payload.attempt + 1,
|
|
129
|
+
time: Date.now(),
|
|
130
|
+
chunk: payload.chunk,
|
|
131
|
+
});
|
|
132
|
+
return (0, exports.streamRendererFunctionWithRetry)({
|
|
133
|
+
files,
|
|
134
|
+
functionName,
|
|
135
|
+
outdir,
|
|
136
|
+
overallProgress,
|
|
137
|
+
payload: {
|
|
138
|
+
...payload,
|
|
139
|
+
attempt: payload.attempt + 1,
|
|
140
|
+
retriesLeft: payload.retriesLeft - 1,
|
|
141
|
+
},
|
|
142
|
+
logLevel,
|
|
143
|
+
onArtifact,
|
|
144
|
+
providerSpecifics,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
exports.streamRendererFunctionWithRetry = streamRendererFunctionWithRetry;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
3
|
+
type Options = {
|
|
4
|
+
expectedBucketOwner: string;
|
|
5
|
+
getRemainingTimeInMillis: () => number;
|
|
6
|
+
};
|
|
7
|
+
export declare const launchHandler: <Provider extends CloudProvider>(params: ServerlessPayload<Provider>, options: Options, providerSpecifics: ProviderSpecifics<Provider>) => Promise<{
|
|
8
|
+
type: "success";
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|