@remotion/serverless 4.0.245 → 4.0.246
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/.turbo/turbo-make.log +1 -1
- package/dist/best-frames-per-function-param.js +5 -5
- package/dist/client.d.ts +9 -0
- package/dist/client.js +30 -12
- package/dist/compress-props.d.ts +6 -2
- package/dist/compress-props.js +5 -3
- package/dist/concat-videos.d.ts +3 -4
- package/dist/concat-videos.js +2 -2
- package/dist/constants.d.ts +39 -3
- package/dist/constants.js +8 -1
- package/dist/create-post-render-data.d.ts +1 -1
- package/dist/create-post-render-data.js +2 -2
- package/dist/estimate-price-from-bucket.d.ts +2 -2
- package/dist/estimate-price-from-bucket.js +4 -4
- package/dist/expected-out-name.d.ts +1 -1
- package/dist/get-browser-instance.d.ts +5 -12
- package/dist/get-browser-instance.js +8 -7
- package/dist/get-custom-out-name.d.ts +1 -1
- package/dist/get-or-create-bucket.d.ts +1 -1
- package/dist/handlers/check-version-mismatch.d.ts +8 -0
- package/dist/handlers/check-version-mismatch.js +23 -0
- package/dist/handlers/compositions.d.ts +7 -2
- package/dist/handlers/compositions.js +25 -25
- package/dist/handlers/launch.d.ts +3 -2
- package/dist/handlers/launch.js +30 -31
- package/dist/handlers/progress.d.ts +6 -2
- package/dist/handlers/progress.js +23 -20
- package/dist/handlers/renderer.d.ts +3 -2
- package/dist/handlers/renderer.js +13 -11
- package/dist/handlers/start.d.ts +7 -2
- package/dist/handlers/start.js +10 -11
- package/dist/handlers/still.d.ts +2 -1
- package/dist/handlers/still.js +68 -67
- package/dist/index.d.ts +21 -5
- package/dist/index.js +54 -7
- package/dist/info.d.ts +1 -1
- package/dist/inner-routine.d.ts +22 -0
- package/dist/inner-routine.js +267 -0
- package/dist/inspect-error.d.ts +2 -2
- package/dist/invoke-webhook.d.ts +14 -11
- package/dist/invoke-webhook.js +1 -1
- package/dist/is-warm.d.ts +2 -0
- package/dist/is-warm.js +10 -0
- package/dist/make-bucket-name.d.ts +1 -1
- package/dist/make-timeout-error.d.ts +1 -1
- package/dist/make-timeout-message.js +3 -2
- package/dist/merge-chunks.d.ts +2 -1
- package/dist/merge-chunks.js +3 -3
- package/dist/most-expensive-chunks.d.ts +2 -2
- package/dist/most-expensive-chunks.js +1 -1
- package/dist/overall-render-progress.d.ts +3 -3
- package/dist/plan-frame-ranges.d.ts +2 -2
- package/dist/plan-frame-ranges.js +4 -4
- package/dist/print-logging-grep-helper.d.ts +4 -0
- package/dist/print-logging-grep-helper.js +12 -0
- package/dist/progress.js +2 -2
- package/dist/provider-implementation.d.ts +152 -3
- package/dist/render-metadata.d.ts +1 -1
- package/dist/render-progress.d.ts +1 -1
- package/dist/streaming/streaming.d.ts +6 -6
- package/dist/streaming/streaming.js +3 -3
- package/dist/types.d.ts +3 -2
- package/dist/validate-composition.d.ts +1 -1
- package/dist/validate-composition.js +11 -1
- package/dist/validate-frames-per-function.d.ts +2 -2
- package/dist/validate-frames-per-function.js +13 -13
- package/dist/{write-lambda-error.d.ts → write-error-to-storage.d.ts} +4 -4
- package/package.json +6 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/.turbo/turbo-formatting.log +0 -7
- package/.turbo/turbo-lint.log +0 -11
- package/dist/compositions.d.ts +0 -11
- package/dist/compositions.js +0 -82
- package/dist/still.d.ts +0 -28
- package/dist/still.js +0 -2
- package/dist/validate-frames-per-lambda.d.ts +0 -4
- package/dist/validate-frames-per-lambda.js +0 -29
- /package/dist/{write-lambda-error.js → write-error-to-storage.js} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.innerRoutine = exports.innerHandler = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const client_1 = require("./client");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const compositions_1 = require("./handlers/compositions");
|
|
8
|
+
const launch_1 = require("./handlers/launch");
|
|
9
|
+
const progress_1 = require("./handlers/progress");
|
|
10
|
+
const renderer_2 = require("./handlers/renderer");
|
|
11
|
+
const start_1 = require("./handlers/start");
|
|
12
|
+
const still_1 = require("./handlers/still");
|
|
13
|
+
const info_1 = require("./info");
|
|
14
|
+
const is_warm_1 = require("./is-warm");
|
|
15
|
+
const leak_detection_1 = require("./leak-detection");
|
|
16
|
+
const print_logging_grep_helper_1 = require("./print-logging-grep-helper");
|
|
17
|
+
const innerHandler = async ({ params, responseWriter, context, providerSpecifics, insideFunctionSpecifics, webhookClient, }) => {
|
|
18
|
+
(0, leak_detection_1.setCurrentRequestId)(context.awsRequestId);
|
|
19
|
+
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
20
|
+
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
21
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: params.logLevel }, 'AWS Request ID:', context.awsRequestId);
|
|
22
|
+
(0, leak_detection_1.stopLeakDetection)();
|
|
23
|
+
if (!(context === null || context === void 0 ? void 0 : context.invokedFunctionArn)) {
|
|
24
|
+
throw new Error('Lambda function unexpectedly does not have context.invokedFunctionArn');
|
|
25
|
+
}
|
|
26
|
+
await insideFunctionSpecifics.deleteTmpDir();
|
|
27
|
+
const isWarm = (0, is_warm_1.getWarm)();
|
|
28
|
+
(0, is_warm_1.setWarm)();
|
|
29
|
+
const currentUserId = context.invokedFunctionArn.split(':')[4];
|
|
30
|
+
if (params.type === constants_1.ServerlessRoutines.still) {
|
|
31
|
+
providerSpecifics.validateDeleteAfter(params.deleteAfter);
|
|
32
|
+
const renderId = insideFunctionSpecifics.generateRandomId({
|
|
33
|
+
deleteAfter: params.deleteAfter,
|
|
34
|
+
randomHashFn: providerSpecifics.randomHash,
|
|
35
|
+
});
|
|
36
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
37
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.still, {
|
|
38
|
+
renderId,
|
|
39
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
40
|
+
isWarm,
|
|
41
|
+
}, params.logLevel);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
await new Promise((resolve, reject) => {
|
|
45
|
+
const onStream = async (payload) => {
|
|
46
|
+
if (!params.streamed) {
|
|
47
|
+
if (payload.type !== 'still-rendered') {
|
|
48
|
+
throw new Error('Expected still-rendered');
|
|
49
|
+
}
|
|
50
|
+
await responseWriter.write(Buffer.from(JSON.stringify(payload.payload)));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const message = (0, client_1.makeStreamPayload)({
|
|
54
|
+
message: payload,
|
|
55
|
+
});
|
|
56
|
+
return new Promise((innerResolve, innerReject) => {
|
|
57
|
+
responseWriter
|
|
58
|
+
.write(message)
|
|
59
|
+
.then(() => {
|
|
60
|
+
innerResolve();
|
|
61
|
+
})
|
|
62
|
+
.catch((err) => {
|
|
63
|
+
reject(err);
|
|
64
|
+
innerReject(err);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
if (params.streamed) {
|
|
69
|
+
onStream({
|
|
70
|
+
type: 'render-id-determined',
|
|
71
|
+
payload: { renderId },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
(0, still_1.stillHandler)({
|
|
75
|
+
expectedBucketOwner: currentUserId,
|
|
76
|
+
params,
|
|
77
|
+
renderId,
|
|
78
|
+
onStream,
|
|
79
|
+
timeoutInMilliseconds,
|
|
80
|
+
providerSpecifics,
|
|
81
|
+
insideFunctionSpecifics,
|
|
82
|
+
})
|
|
83
|
+
.then((r) => {
|
|
84
|
+
resolve(r);
|
|
85
|
+
})
|
|
86
|
+
.catch((err) => {
|
|
87
|
+
reject(err);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
await responseWriter.end();
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
// eslint-disable-next-line no-console
|
|
94
|
+
console.log({ err });
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (params.type === constants_1.ServerlessRoutines.start) {
|
|
99
|
+
const renderId = insideFunctionSpecifics.generateRandomId({
|
|
100
|
+
deleteAfter: params.deleteAfter,
|
|
101
|
+
randomHashFn: providerSpecifics.randomHash,
|
|
102
|
+
});
|
|
103
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
104
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.start, {
|
|
105
|
+
renderId,
|
|
106
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
107
|
+
isWarm,
|
|
108
|
+
}, params.logLevel);
|
|
109
|
+
}
|
|
110
|
+
const response = await (0, start_1.startHandler)({
|
|
111
|
+
params,
|
|
112
|
+
options: {
|
|
113
|
+
expectedBucketOwner: currentUserId,
|
|
114
|
+
timeoutInMilliseconds,
|
|
115
|
+
renderId,
|
|
116
|
+
},
|
|
117
|
+
providerSpecifics,
|
|
118
|
+
insideFunctionSpecifics,
|
|
119
|
+
});
|
|
120
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
121
|
+
await responseWriter.end();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (params.type === constants_1.ServerlessRoutines.launch) {
|
|
125
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
126
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.launch, {
|
|
127
|
+
renderId: params.renderId,
|
|
128
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
129
|
+
isWarm,
|
|
130
|
+
}, params.logLevel);
|
|
131
|
+
}
|
|
132
|
+
const response = await (0, launch_1.launchHandler)({
|
|
133
|
+
params,
|
|
134
|
+
options: {
|
|
135
|
+
expectedBucketOwner: currentUserId,
|
|
136
|
+
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
137
|
+
},
|
|
138
|
+
providerSpecifics,
|
|
139
|
+
client: webhookClient,
|
|
140
|
+
insideFunctionSpecifics,
|
|
141
|
+
});
|
|
142
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
143
|
+
await responseWriter.end();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (params.type === constants_1.ServerlessRoutines.status) {
|
|
147
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
148
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.status, {
|
|
149
|
+
renderId: params.renderId,
|
|
150
|
+
isWarm,
|
|
151
|
+
}, params.logLevel);
|
|
152
|
+
}
|
|
153
|
+
const response = await (0, progress_1.progressHandler)({
|
|
154
|
+
params,
|
|
155
|
+
options: {
|
|
156
|
+
expectedBucketOwner: currentUserId,
|
|
157
|
+
timeoutInMilliseconds,
|
|
158
|
+
retriesRemaining: 2,
|
|
159
|
+
providerSpecifics,
|
|
160
|
+
insideFunctionSpecifics,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
164
|
+
await responseWriter.end();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (params.type === constants_1.ServerlessRoutines.renderer) {
|
|
168
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
169
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.renderer, {
|
|
170
|
+
renderId: params.renderId,
|
|
171
|
+
chunk: String(params.chunk),
|
|
172
|
+
dumpLogs: String(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')),
|
|
173
|
+
resolvedProps: JSON.stringify(params.resolvedProps),
|
|
174
|
+
isWarm,
|
|
175
|
+
}, params.logLevel);
|
|
176
|
+
}
|
|
177
|
+
await new Promise((resolve, reject) => {
|
|
178
|
+
(0, renderer_2.rendererHandler)({
|
|
179
|
+
params,
|
|
180
|
+
options: {
|
|
181
|
+
expectedBucketOwner: currentUserId,
|
|
182
|
+
isWarm,
|
|
183
|
+
},
|
|
184
|
+
onStream: (payload) => {
|
|
185
|
+
const message = (0, client_1.makeStreamPayload)({
|
|
186
|
+
message: payload,
|
|
187
|
+
});
|
|
188
|
+
const writeProm = responseWriter.write(message);
|
|
189
|
+
return new Promise((innerResolve, innerReject) => {
|
|
190
|
+
writeProm
|
|
191
|
+
.then(() => {
|
|
192
|
+
innerResolve();
|
|
193
|
+
})
|
|
194
|
+
.catch((err) => {
|
|
195
|
+
reject(err);
|
|
196
|
+
innerReject(err);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
requestContext: context,
|
|
201
|
+
providerSpecifics,
|
|
202
|
+
insideFunctionSpecifics,
|
|
203
|
+
})
|
|
204
|
+
.then((res) => {
|
|
205
|
+
resolve(res);
|
|
206
|
+
})
|
|
207
|
+
.catch((err) => {
|
|
208
|
+
reject(err);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
await responseWriter.end();
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (params.type === constants_1.ServerlessRoutines.info) {
|
|
215
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
216
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.info, {
|
|
217
|
+
isWarm,
|
|
218
|
+
}, params.logLevel);
|
|
219
|
+
}
|
|
220
|
+
const response = await (0, info_1.infoHandler)(params);
|
|
221
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
222
|
+
await responseWriter.end();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (params.type === constants_1.ServerlessRoutines.compositions) {
|
|
226
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
227
|
+
(0, print_logging_grep_helper_1.printLoggingGrepHelper)(constants_1.ServerlessRoutines.compositions, {
|
|
228
|
+
isWarm,
|
|
229
|
+
}, params.logLevel);
|
|
230
|
+
}
|
|
231
|
+
const response = await (0, compositions_1.compositionsHandler)({
|
|
232
|
+
params,
|
|
233
|
+
options: {
|
|
234
|
+
expectedBucketOwner: currentUserId,
|
|
235
|
+
},
|
|
236
|
+
providerSpecifics,
|
|
237
|
+
insideFunctionSpecifics,
|
|
238
|
+
});
|
|
239
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
240
|
+
await responseWriter.end();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
throw new Error(constants_1.COMMAND_NOT_FOUND);
|
|
244
|
+
};
|
|
245
|
+
exports.innerHandler = innerHandler;
|
|
246
|
+
const innerRoutine = async ({ params, responseWriter, context, providerSpecifics, insideFunctionSpecifics, webhookClient, }) => {
|
|
247
|
+
try {
|
|
248
|
+
await (0, exports.innerHandler)({
|
|
249
|
+
params,
|
|
250
|
+
responseWriter,
|
|
251
|
+
context,
|
|
252
|
+
providerSpecifics,
|
|
253
|
+
insideFunctionSpecifics,
|
|
254
|
+
webhookClient,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
const res = {
|
|
259
|
+
type: 'error',
|
|
260
|
+
message: err.message,
|
|
261
|
+
stack: err.stack,
|
|
262
|
+
};
|
|
263
|
+
await responseWriter.write(Buffer.from(JSON.stringify(res)));
|
|
264
|
+
await responseWriter.end();
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
exports.innerRoutine = innerRoutine;
|
package/dist/inspect-error.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnhancedErrorInfo,
|
|
1
|
+
import type { EnhancedErrorInfo, FunctionErrorInfo } from './write-error-to-storage';
|
|
2
2
|
export declare const inspectErrors: ({ errors, }: {
|
|
3
|
-
errors:
|
|
3
|
+
errors: FunctionErrorInfo[];
|
|
4
4
|
}) => EnhancedErrorInfo[];
|
package/dist/invoke-webhook.d.ts
CHANGED
|
@@ -2,32 +2,35 @@ import type { LogLevel } from '@remotion/renderer';
|
|
|
2
2
|
import type https from 'https';
|
|
3
3
|
import type http from 'node:http';
|
|
4
4
|
import type { AfterRenderCost } from './constants';
|
|
5
|
-
import type { EnhancedErrorInfo } from './write-
|
|
5
|
+
import type { EnhancedErrorInfo } from './write-error-to-storage';
|
|
6
6
|
export declare function calculateSignature(payload: string, secret: string | null): string;
|
|
7
|
-
type
|
|
7
|
+
type StaticWebhookPayload = {
|
|
8
|
+
renderId: string;
|
|
9
|
+
expectedBucketOwner: string;
|
|
10
|
+
bucketName: string;
|
|
11
|
+
customData: Record<string, unknown> | null;
|
|
12
|
+
};
|
|
13
|
+
export type WebhookErrorPayload = StaticWebhookPayload & {
|
|
8
14
|
type: 'error';
|
|
9
15
|
errors: {
|
|
10
16
|
message: string;
|
|
11
17
|
name: string;
|
|
12
18
|
stack: string;
|
|
13
19
|
}[];
|
|
14
|
-
}
|
|
20
|
+
};
|
|
21
|
+
export type WebhookSuccessPayload = StaticWebhookPayload & {
|
|
15
22
|
type: 'success';
|
|
16
23
|
lambdaErrors: EnhancedErrorInfo[];
|
|
17
24
|
outputUrl: string | undefined;
|
|
18
25
|
outputFile: string | undefined;
|
|
19
26
|
timeToFinish: number | undefined;
|
|
20
27
|
costs: AfterRenderCost;
|
|
21
|
-
}
|
|
28
|
+
};
|
|
29
|
+
export type WebhookTimeoutPayload = StaticWebhookPayload & {
|
|
22
30
|
type: 'timeout';
|
|
23
31
|
};
|
|
24
|
-
export type WebhookPayload =
|
|
25
|
-
|
|
26
|
-
expectedBucketOwner: string;
|
|
27
|
-
bucketName: string;
|
|
28
|
-
customData: Record<string, unknown> | null;
|
|
29
|
-
} & DynamicWebhookPayload;
|
|
30
|
-
export type WebhookClient = (url: string | URL, options: https.RequestOptions, callback?: (res: http.IncomingMessage) => void) => http.ClientRequest;
|
|
32
|
+
export type WebhookPayload = WebhookErrorPayload | WebhookSuccessPayload | WebhookTimeoutPayload;
|
|
33
|
+
export type WebhookClient = (url: string) => (url: string | URL, options: https.RequestOptions, callback?: (res: http.IncomingMessage) => void) => http.ClientRequest;
|
|
31
34
|
type InvokeWebhookOptions = {
|
|
32
35
|
payload: WebhookPayload;
|
|
33
36
|
url: string;
|
package/dist/invoke-webhook.js
CHANGED
|
@@ -41,7 +41,7 @@ const redirectStatusCodes = [301, 302, 303, 307, 308];
|
|
|
41
41
|
function invokeWebhookRaw({ payload, secret, url, redirectsSoFar, client, }) {
|
|
42
42
|
const jsonPayload = JSON.stringify(payload);
|
|
43
43
|
return new Promise((resolve, reject) => {
|
|
44
|
-
const req = client(url, {
|
|
44
|
+
const req = client(url)(url, {
|
|
45
45
|
method: 'POST',
|
|
46
46
|
headers: {
|
|
47
47
|
'Content-Type': 'application/json',
|
package/dist/is-warm.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWarm = exports.setWarm = void 0;
|
|
4
|
+
let warm = false;
|
|
5
|
+
const setWarm = () => {
|
|
6
|
+
warm = true;
|
|
7
|
+
};
|
|
8
|
+
exports.setWarm = setWarm;
|
|
9
|
+
const getWarm = () => warm;
|
|
10
|
+
exports.getWarm = getWarm;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ProviderSpecifics } from './provider-implementation';
|
|
2
|
-
import type { CloudProvider } from './
|
|
2
|
+
import type { CloudProvider } from './types';
|
|
3
3
|
export declare const makeBucketName: <Provider extends CloudProvider>(region: Provider["region"], providerSpecifics: ProviderSpecifics<Provider>) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderSpecifics } from './provider-implementation';
|
|
2
2
|
import type { RenderMetadata } from './render-metadata';
|
|
3
3
|
import type { CloudProvider } from './types';
|
|
4
|
-
import type { EnhancedErrorInfo } from './write-
|
|
4
|
+
import type { EnhancedErrorInfo } from './write-error-to-storage';
|
|
5
5
|
export declare const makeTimeoutError: <Provider extends CloudProvider>({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, functionName, region, providerSpecifics, }: {
|
|
6
6
|
timeoutInMilliseconds: number;
|
|
7
7
|
renderMetadata: RenderMetadata<Provider>;
|
|
@@ -4,7 +4,7 @@ exports.makeTimeoutMessage = void 0;
|
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const docs_url_1 = require("./docs-url");
|
|
6
6
|
const MAX_MISSING_CHUNKS = 5;
|
|
7
|
-
const makeChunkMissingMessage = ({ missingChunks, renderMetadata, region, providerSpecifics, }) => {
|
|
7
|
+
const makeChunkMissingMessage = ({ missingChunks, renderMetadata, region, providerSpecifics, functionName, }) => {
|
|
8
8
|
if (missingChunks.length === 0) {
|
|
9
9
|
return 'All chunks have been successfully rendered, but the main function has timed out.';
|
|
10
10
|
}
|
|
@@ -23,7 +23,7 @@ const makeChunkMissingMessage = ({ missingChunks, renderMetadata, region, provid
|
|
|
23
23
|
return [
|
|
24
24
|
msg,
|
|
25
25
|
`▸ Logs for chunk ${ch}: ${providerSpecifics.getLoggingUrlForRendererFunction({
|
|
26
|
-
functionName
|
|
26
|
+
functionName,
|
|
27
27
|
region,
|
|
28
28
|
rendererFunctionName: null,
|
|
29
29
|
renderId: renderMetadata.renderId,
|
|
@@ -56,6 +56,7 @@ const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetada
|
|
|
56
56
|
renderMetadata,
|
|
57
57
|
region,
|
|
58
58
|
providerSpecifics,
|
|
59
|
+
functionName,
|
|
59
60
|
}),
|
|
60
61
|
'',
|
|
61
62
|
`Consider increasing the timeout of your function.`,
|
package/dist/merge-chunks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AudioCodec, LogLevel } from '@remotion/renderer';
|
|
2
2
|
import type { CustomCredentials, DownloadBehavior, PostRenderData, Privacy, SerializedInputProps, ServerlessCodec } from './constants';
|
|
3
3
|
import type { OverallProgressHelper } from './overall-render-progress';
|
|
4
|
-
import type { ProviderSpecifics } from './provider-implementation';
|
|
4
|
+
import type { InsideFunctionSpecifics, ProviderSpecifics } from './provider-implementation';
|
|
5
5
|
import type { RenderMetadata } from './render-metadata';
|
|
6
6
|
import type { CloudProvider } from './types';
|
|
7
7
|
export declare const mergeChunksAndFinishRender: <Provider extends CloudProvider>(options: {
|
|
@@ -33,5 +33,6 @@ export declare const mergeChunksAndFinishRender: <Provider extends CloudProvider
|
|
|
33
33
|
overallProgress: OverallProgressHelper<Provider>;
|
|
34
34
|
startTime: number;
|
|
35
35
|
providerSpecifics: ProviderSpecifics<Provider>;
|
|
36
|
+
insideFunctionSpecifics: InsideFunctionSpecifics;
|
|
36
37
|
forcePathStyle: boolean;
|
|
37
38
|
}) => Promise<PostRenderData<Provider>>;
|
package/dist/merge-chunks.js
CHANGED
|
@@ -37,12 +37,12 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
37
37
|
preferLossless: options.preferLossless,
|
|
38
38
|
muted: options.renderMetadata.muted,
|
|
39
39
|
metadata: options.renderMetadata.metadata,
|
|
40
|
-
|
|
40
|
+
insideFunctionSpecifics: options.insideFunctionSpecifics,
|
|
41
41
|
});
|
|
42
42
|
const encodingStop = Date.now();
|
|
43
43
|
options.overallProgress.setTimeToCombine(encodingStop - encodingStart);
|
|
44
44
|
const outputSize = fs_1.default.statSync(outfile).size;
|
|
45
|
-
const writeToBucket = options.
|
|
45
|
+
const writeToBucket = options.insideFunctionSpecifics.timer(`Writing to bucket (${outputSize} bytes)`, options.logLevel);
|
|
46
46
|
await options.providerSpecifics.writeFile({
|
|
47
47
|
bucketName: options.renderBucketName,
|
|
48
48
|
key: options.key,
|
|
@@ -72,7 +72,7 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
72
72
|
});
|
|
73
73
|
const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
|
|
74
74
|
region: options.providerSpecifics.getCurrentRegionInFunction(),
|
|
75
|
-
memorySizeInMb:
|
|
75
|
+
memorySizeInMb: options.insideFunctionSpecifics.getCurrentMemorySizeInMb(),
|
|
76
76
|
renderMetadata: options.renderMetadata,
|
|
77
77
|
errorExplanations,
|
|
78
78
|
timeToDelete: (await cleanupProm).reduce((a, b) => Math.max(a, b), 0),
|
|
@@ -5,9 +5,9 @@ export type ExpensiveChunk = {
|
|
|
5
5
|
frameRange: [number, number];
|
|
6
6
|
timeInMilliseconds: number;
|
|
7
7
|
};
|
|
8
|
-
export declare const getMostExpensiveChunks: ({ parsedTimings, framesPerLambda, firstFrame, lastFrame, }: {
|
|
8
|
+
export declare const getMostExpensiveChunks: ({ parsedTimings, framesPerFunction: framesPerLambda, firstFrame, lastFrame, }: {
|
|
9
9
|
parsedTimings: ParsedTiming[];
|
|
10
|
-
|
|
10
|
+
framesPerFunction: number;
|
|
11
11
|
firstFrame: number;
|
|
12
12
|
lastFrame: number;
|
|
13
13
|
}) => ExpensiveChunk[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMostExpensiveChunks = exports.OVERHEAD_TIME_PER_LAMBDA = void 0;
|
|
4
4
|
exports.OVERHEAD_TIME_PER_LAMBDA = 100;
|
|
5
|
-
const getMostExpensiveChunks = ({ parsedTimings, framesPerLambda, firstFrame, lastFrame, }) => {
|
|
5
|
+
const getMostExpensiveChunks = ({ parsedTimings, framesPerFunction: framesPerLambda, firstFrame, lastFrame, }) => {
|
|
6
6
|
const mostExpensiveChunks = parsedTimings
|
|
7
7
|
.slice(0)
|
|
8
8
|
.sort((a, b) => {
|
|
@@ -3,7 +3,7 @@ import type { PostRenderData } from './constants';
|
|
|
3
3
|
import type { ProviderSpecifics } from './provider-implementation';
|
|
4
4
|
import type { RenderMetadata } from './render-metadata';
|
|
5
5
|
import type { ChunkRetry, CloudProvider, ParsedTiming, ReceivedArtifact } from './types';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FunctionErrorInfo } from './write-error-to-storage';
|
|
7
7
|
export type OverallRenderProgress<Provider extends CloudProvider> = {
|
|
8
8
|
chunks: number[];
|
|
9
9
|
framesRendered: number;
|
|
@@ -17,7 +17,7 @@ export type OverallRenderProgress<Provider extends CloudProvider> = {
|
|
|
17
17
|
postRenderData: PostRenderData<Provider> | null;
|
|
18
18
|
timings: ParsedTiming[];
|
|
19
19
|
renderMetadata: RenderMetadata<Provider> | null;
|
|
20
|
-
errors:
|
|
20
|
+
errors: FunctionErrorInfo[];
|
|
21
21
|
timeoutTimestamp: number;
|
|
22
22
|
functionLaunched: number;
|
|
23
23
|
serveUrlOpened: number | null;
|
|
@@ -38,7 +38,7 @@ export type OverallProgressHelper<Provider extends CloudProvider> = {
|
|
|
38
38
|
addRetry: (retry: ChunkRetry) => void;
|
|
39
39
|
setPostRenderData: (postRenderData: PostRenderData<Provider>) => void;
|
|
40
40
|
setRenderMetadata: (renderMetadata: RenderMetadata<Provider>) => void;
|
|
41
|
-
addErrorWithoutUpload: (errorInfo:
|
|
41
|
+
addErrorWithoutUpload: (errorInfo: FunctionErrorInfo) => void;
|
|
42
42
|
setExpectedChunks: (expectedChunks: number) => void;
|
|
43
43
|
get: () => OverallRenderProgress<Provider>;
|
|
44
44
|
setServeUrlOpened: (timestamp: number) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const planFrameRanges: ({
|
|
2
|
-
|
|
1
|
+
export declare const planFrameRanges: ({ framesPerFunction, frameRange, everyNthFrame, }: {
|
|
2
|
+
framesPerFunction: number;
|
|
3
3
|
frameRange: [number, number];
|
|
4
4
|
everyNthFrame: number;
|
|
5
5
|
}) => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.planFrameRanges = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const planFrameRanges = ({
|
|
5
|
+
const planFrameRanges = ({ framesPerFunction, frameRange, everyNthFrame, }) => {
|
|
6
6
|
const framesToRender = renderer_1.RenderInternals.getFramesToRender(frameRange, everyNthFrame);
|
|
7
|
-
const chunkCount = Math.ceil(framesToRender.length /
|
|
7
|
+
const chunkCount = Math.ceil(framesToRender.length / framesPerFunction);
|
|
8
8
|
const firstFrame = frameRange[0];
|
|
9
9
|
return {
|
|
10
10
|
chunks: new Array(chunkCount).fill(1).map((_, i) => {
|
|
11
|
-
const start = i *
|
|
12
|
-
const end = Math.min(framesToRender[framesToRender.length - 1], (i + 1) *
|
|
11
|
+
const start = i * framesPerFunction * everyNthFrame + firstFrame;
|
|
12
|
+
const end = Math.min(framesToRender[framesToRender.length - 1], (i + 1) * framesPerFunction * everyNthFrame - 1 + firstFrame);
|
|
13
13
|
return [start, end];
|
|
14
14
|
}),
|
|
15
15
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from '@remotion/renderer';
|
|
2
|
+
import type { ServerlessRoutines } from './constants';
|
|
3
|
+
export type PrintLoggingHelper = (type: ServerlessRoutines, data: Record<string, string | boolean>, logLevel: LogLevel) => void;
|
|
4
|
+
export declare const printLoggingGrepHelper: PrintLoggingHelper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printLoggingGrepHelper = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const printLoggingGrepHelper = (type, data, logLevel) => {
|
|
6
|
+
const d = Object.keys(data).reduce((a, b) => {
|
|
7
|
+
return [...a, `${b}=${data[b]}`];
|
|
8
|
+
}, []);
|
|
9
|
+
const msg = [`method=${type}`, ...d].join(',');
|
|
10
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, msg);
|
|
11
|
+
};
|
|
12
|
+
exports.printLoggingGrepHelper = printLoggingGrepHelper;
|
package/dist/progress.js
CHANGED
|
@@ -145,10 +145,10 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
145
145
|
artifacts: overallProgress.receivedArtifact,
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
const priceFromBucket = (0, estimate_price_from_bucket_1.
|
|
148
|
+
const priceFromBucket = (0, estimate_price_from_bucket_1.estimatePriceFromMetadata)({
|
|
149
149
|
renderMetadata,
|
|
150
150
|
memorySizeInMb,
|
|
151
|
-
|
|
151
|
+
functionsInvoked: (_h = renderMetadata.estimatedRenderLambdaInvokations) !== null && _h !== void 0 ? _h : 0,
|
|
152
152
|
diskSizeInMb: providerSpecifics.getEphemeralStorageForPriceCalculation(),
|
|
153
153
|
timings: (_j = overallProgress.timings) !== null && _j !== void 0 ? _j : [],
|
|
154
154
|
region,
|