@remotion/cloudrun 4.1.0-alpha4 → 4.1.0-alpha7
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-build.log +3 -3
- package/dist/api/helpers/construct-service-deploy-request.js +1 -1
- package/dist/api/helpers/extract-mem-from-url.d.ts +1 -0
- package/dist/api/helpers/extract-mem-from-url.js +9 -0
- package/dist/api/helpers/extract-time-from-url.d.ts +1 -0
- package/dist/api/helpers/extract-time-from-url.js +13 -0
- package/dist/api/helpers/get-cloud-logging-client.d.ts +1 -0
- package/dist/api/helpers/get-cloud-logging-client.js +15 -0
- package/dist/api/render-media-on-cloudrun.d.ts +4 -4
- package/dist/api/render-media-on-cloudrun.js +17 -2
- package/dist/cli/commands/render/index.js +77 -16
- package/dist/functions/helpers/get-composition-from-body.d.ts +2 -1
- package/dist/functions/helpers/get-composition-from-body.js +20 -6
- package/dist/functions/helpers/payloads.d.ts +25 -2
- package/dist/functions/helpers/payloads.js +10 -2
- package/dist/functions/render-media-single-thread.js +4 -4
- package/dist/functions/render-still-single-thread.js +1 -1
- package/dist/shared/sa-permissions.json +4 -0
- package/dist/shared/validate-image-remotion-version.js +1 -1
- package/package.json +7 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/cli/commands/render/renderMedia.d.ts +0 -2
- package/dist/cli/commands/render/renderMedia.js +0 -156
- package/dist/cli/commands/render/renderStill.d.ts +0 -2
- package/dist/cli/commands/render/renderStill.js +0 -123
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @remotion/cloudrun@3.3.101 build /Users/jonathanburger/remotion
|
|
2
|
+
> @remotion/cloudrun@3.3.101 build /Users/jonathanburger/remotion/packages/cloudrun
|
|
3
3
|
> tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json && pnpm run buildContainer && pnpm run tarInstaller
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @remotion/cloudrun@3.3.101 buildContainer /Users/jonathanburger/remotion
|
|
6
|
+
> @remotion/cloudrun@3.3.101 buildContainer /Users/jonathanburger/remotion/packages/cloudrun
|
|
7
7
|
> ts-node src/admin/bundle-renderLogic.ts
|
|
8
8
|
|
|
9
9
|
distribution bundled.
|
|
10
10
|
|
|
11
|
-
> @remotion/cloudrun@3.3.101 tarInstaller /Users/jonathanburger/remotion
|
|
11
|
+
> @remotion/cloudrun@3.3.101 tarInstaller /Users/jonathanburger/remotion/packages/cloudrun
|
|
12
12
|
> ts-node src/admin/bundle-installer.ts
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ const constructServiceTemplate = ({ memoryLimit, cpuLimit, timeoutSeconds, minIn
|
|
|
20
20
|
},
|
|
21
21
|
containers: [
|
|
22
22
|
{
|
|
23
|
-
image: `us-docker.pkg.dev/remotion-dev/
|
|
23
|
+
image: `us-docker.pkg.dev/remotion-dev/production/render:${version_1.VERSION}`,
|
|
24
24
|
resources: {
|
|
25
25
|
limits: {
|
|
26
26
|
memory: memoryLimit,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractMemoryFromURL(url: string): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractMemoryFromURL = void 0;
|
|
4
|
+
function extractMemoryFromURL(url) {
|
|
5
|
+
const regex = /mem(.*?)-/;
|
|
6
|
+
const match = url.match(regex);
|
|
7
|
+
return match ? match[1] : undefined;
|
|
8
|
+
}
|
|
9
|
+
exports.extractMemoryFromURL = extractMemoryFromURL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractTimeoutFromURL(url: string): number | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractTimeoutFromURL = void 0;
|
|
4
|
+
function extractTimeoutFromURL(url) {
|
|
5
|
+
const firstTIndex = url.indexOf('-t');
|
|
6
|
+
if (firstTIndex !== -1) {
|
|
7
|
+
const substrAfterT = url.substring(firstTIndex + 2);
|
|
8
|
+
const numberStr = substrAfterT.split('-')[0];
|
|
9
|
+
return parseInt(numberStr, 10);
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
exports.extractTimeoutFromURL = extractTimeoutFromURL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCloudLoggingClient: () => any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCloudLoggingClient = void 0;
|
|
4
|
+
const logging_1 = require("@google-cloud/logging");
|
|
5
|
+
const { LoggingServiceV2Client } = logging_1.v2;
|
|
6
|
+
const getCloudLoggingClient = () => {
|
|
7
|
+
return new LoggingServiceV2Client({
|
|
8
|
+
projectId: process.env.REMOTION_GCP_PROJECT_ID,
|
|
9
|
+
credentials: {
|
|
10
|
+
client_email: process.env.REMOTION_GCP_CLIENT_EMAIL,
|
|
11
|
+
private_key: process.env.REMOTION_GCP_PRIVATE_KEY,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
exports.getCloudLoggingClient = getCloudLoggingClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChromiumOptions, FrameRange, LogLevel } from '@remotion/renderer';
|
|
2
|
-
import type { RenderMediaOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
2
|
+
import type { CloudRunCrashResponse, RenderMediaOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
3
3
|
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
4
4
|
import type { CloudrunCodec } from '../shared/validate-gcp-codec';
|
|
5
5
|
export declare type RenderMediaOnCloudrunInput = {
|
|
@@ -12,7 +12,7 @@ export declare type RenderMediaOnCloudrunInput = {
|
|
|
12
12
|
privacy?: 'public' | 'private';
|
|
13
13
|
forceBucketName?: string;
|
|
14
14
|
outName?: string;
|
|
15
|
-
updateRenderProgress?: (progress: number) => void;
|
|
15
|
+
updateRenderProgress?: (progress: number, error?: boolean) => void;
|
|
16
16
|
codec: CloudrunCodec;
|
|
17
17
|
audioCodec?: 'mp3' | 'aac' | 'pcm-16' | 'opus';
|
|
18
18
|
jpegQuality?: number;
|
|
@@ -70,9 +70,9 @@ export declare type RenderMediaOnCloudrunInput = {
|
|
|
70
70
|
* @param params.forceHeight Overrides default composition height.
|
|
71
71
|
* @param params.logLevel Level of logging that Cloud Run service should perform. Default "info".
|
|
72
72
|
* @param params.delayRenderTimeoutInMilliseconds A number describing how long the render may take to resolve all delayRender() calls before it times out.
|
|
73
|
-
* @param params.concurrency By default, each Cloud Run service renders with concurrency
|
|
73
|
+
* @param params.concurrency By default, each Cloud Run service renders with concurrency 100% (equal to number of available cores). You may use the option to customize this value.
|
|
74
74
|
* @param params.enforceAudioTrack Render a silent audio track if there wouldn't be any otherwise.
|
|
75
75
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
76
76
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
77
77
|
*/
|
|
78
|
-
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput>;
|
|
78
|
+
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
@@ -41,7 +41,7 @@ const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
|
|
|
41
41
|
* @param params.forceHeight Overrides default composition height.
|
|
42
42
|
* @param params.logLevel Level of logging that Cloud Run service should perform. Default "info".
|
|
43
43
|
* @param params.delayRenderTimeoutInMilliseconds A number describing how long the render may take to resolve all delayRender() calls before it times out.
|
|
44
|
-
* @param params.concurrency By default, each Cloud Run service renders with concurrency
|
|
44
|
+
* @param params.concurrency By default, each Cloud Run service renders with concurrency 100% (equal to number of available cores). You may use the option to customize this value.
|
|
45
45
|
* @param params.enforceAudioTrack Render a silent audio track if there wouldn't be any otherwise.
|
|
46
46
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
47
47
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
@@ -99,6 +99,8 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
|
|
|
99
99
|
const renderResponse = await new Promise((resolve, reject) => {
|
|
100
100
|
// TODO: Add any sort of type safety
|
|
101
101
|
let response;
|
|
102
|
+
const startTime = Date.now();
|
|
103
|
+
const formattedStartTime = new Date().toISOString();
|
|
102
104
|
const stream = postResponse.data;
|
|
103
105
|
stream.on('data', (chunk) => {
|
|
104
106
|
const chunkResponse = JSON.parse(chunk.toString());
|
|
@@ -110,7 +112,20 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
|
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
stream.on('end', () => {
|
|
113
|
-
if (response
|
|
115
|
+
if (!response) {
|
|
116
|
+
const crashTime = Date.now();
|
|
117
|
+
const formattedCrashTime = new Date().toISOString();
|
|
118
|
+
updateRenderProgress === null || updateRenderProgress === void 0 ? void 0 : updateRenderProgress(0, true);
|
|
119
|
+
resolve({
|
|
120
|
+
status: 'crash',
|
|
121
|
+
cloudRunEndpoint,
|
|
122
|
+
message: 'Service crashed without sending a response. Check the logs in GCP console.',
|
|
123
|
+
requestStartTime: formattedStartTime,
|
|
124
|
+
requestCrashTime: formattedCrashTime,
|
|
125
|
+
requestElapsedTimeInSeconds: (crashTime - startTime) / 1000,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
else if (response.status !== 'success' && response.status !== 'crash') {
|
|
114
129
|
throw new Error(response.stack);
|
|
115
130
|
}
|
|
116
131
|
resolve(response);
|
|
@@ -7,6 +7,9 @@ const render_media_on_cloudrun_1 = require("../../../api/render-media-on-cloudru
|
|
|
7
7
|
const config_1 = require("@remotion/cli/config");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
9
|
const download_file_1 = require("../../../api/download-file");
|
|
10
|
+
const extract_mem_from_url_1 = require("../../../api/helpers/extract-mem-from-url");
|
|
11
|
+
const extract_time_from_url_1 = require("../../../api/helpers/extract-time-from-url");
|
|
12
|
+
const get_cloud_logging_client_1 = require("../../../api/helpers/get-cloud-logging-client");
|
|
10
13
|
const validate_serveurl_1 = require("../../../shared/validate-serveurl");
|
|
11
14
|
const args_1 = require("../../args");
|
|
12
15
|
const log_1 = require("../../log");
|
|
@@ -94,9 +97,17 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
|
94
97
|
: cli_1.CliInternals.chalk.gray(`${renderProgress.doneIn}ms`),
|
|
95
98
|
].join(' '), false);
|
|
96
99
|
};
|
|
97
|
-
const updateRenderProgress = (progress) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
const updateRenderProgress = (progress, error) => {
|
|
101
|
+
if (error) {
|
|
102
|
+
// exiting progress and adding space
|
|
103
|
+
log_1.Log.info(`
|
|
104
|
+
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
renderProgress.progress = progress;
|
|
109
|
+
updateProgress();
|
|
110
|
+
}
|
|
100
111
|
};
|
|
101
112
|
const res = await (0, render_media_on_cloudrun_1.renderMediaOnCloudrun)({
|
|
102
113
|
cloudRunUrl,
|
|
@@ -134,12 +145,61 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
|
134
145
|
enforceAudioTrack,
|
|
135
146
|
preferLossless: false,
|
|
136
147
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
if (res.status === 'crash') {
|
|
149
|
+
let timeoutPreMsg = '';
|
|
150
|
+
const timeout = (0, extract_time_from_url_1.extractTimeoutFromURL)(res.cloudRunEndpoint);
|
|
151
|
+
const memoryLimit = (0, extract_mem_from_url_1.extractMemoryFromURL)(res.cloudRunEndpoint);
|
|
152
|
+
if (timeout && res.requestElapsedTimeInSeconds + 10 > timeout) {
|
|
153
|
+
timeoutPreMsg = `Render call likely timed out. Service timeout is ${timeout} seconds, and render took at least ${res.requestElapsedTimeInSeconds.toFixed(1)} seconds.\n`;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
timeoutPreMsg = `Crash unlikely due to timeout. Render took ${res.requestElapsedTimeInSeconds.toFixed(1)} seconds, below the timeout of ${timeout} seconds.\n`;
|
|
157
|
+
}
|
|
158
|
+
log_1.Log.error(`Error rendering on Cloud Run. The Cloud Run service did not return a response.\n
|
|
159
|
+
${timeoutPreMsg}The crash may be due to the service exceeding its memory limit of ${memoryLimit}.
|
|
160
|
+
Full logs are available at https://console.cloud.google.com/run?project=${process.env.REMOTION_GCP_PROJECT_ID}\n`);
|
|
161
|
+
const cloudLoggingClient = (0, get_cloud_logging_client_1.getCloudLoggingClient)();
|
|
162
|
+
const listLogEntriesRequest = {
|
|
163
|
+
resourceNames: [`projects/${process.env.REMOTION_GCP_PROJECT_ID}`],
|
|
164
|
+
filter: `logName=projects/${process.env.REMOTION_GCP_PROJECT_ID}/logs/run.googleapis.com%2Fvarlog%2Fsystem AND (severity=WARNING OR severity=ERROR) AND timestamp >= "${res.requestStartTime}"`,
|
|
165
|
+
};
|
|
166
|
+
const logCheckCountdown = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
167
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
168
|
+
cancelSignal: null,
|
|
169
|
+
updatesDontOverwrite: false,
|
|
170
|
+
indent: false,
|
|
171
|
+
});
|
|
172
|
+
await (() => {
|
|
173
|
+
return new Promise((resolve) => {
|
|
174
|
+
let timeLeft = 30;
|
|
175
|
+
const intervalId = setInterval(() => {
|
|
176
|
+
logCheckCountdown.update(`GCP Cloud Logging takes time to ingest and index logs.\nFetching recent error/warning logs in ${timeLeft} seconds`, false);
|
|
177
|
+
timeLeft--;
|
|
178
|
+
if (timeLeft < 0) {
|
|
179
|
+
logCheckCountdown.update('Fetching logs...\n\n', false);
|
|
180
|
+
clearInterval(intervalId);
|
|
181
|
+
resolve();
|
|
182
|
+
}
|
|
183
|
+
}, 1000);
|
|
184
|
+
});
|
|
185
|
+
})();
|
|
186
|
+
const iterableLogListEntries = await cloudLoggingClient.listLogEntriesAsync(listLogEntriesRequest);
|
|
187
|
+
for await (const logResponse of iterableLogListEntries) {
|
|
188
|
+
const responseDate = new Date(Number(logResponse.timestamp.seconds) * 1000 +
|
|
189
|
+
Number(logResponse.timestamp.nanos) / 1000000);
|
|
190
|
+
const convertedDate = responseDate.toLocaleString();
|
|
191
|
+
log_1.Log.info(convertedDate);
|
|
192
|
+
log_1.Log.info(logResponse.textPayload);
|
|
193
|
+
log_1.Log.info();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (res.status === 'success') {
|
|
197
|
+
renderProgress.doneIn = Date.now() - renderStart;
|
|
198
|
+
updateProgress();
|
|
199
|
+
log_1.Log.info(`
|
|
140
200
|
|
|
141
201
|
`);
|
|
142
|
-
|
|
202
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
|
|
143
203
|
${res.publicUrl ? `Public URL = ${decodeURIComponent(res.publicUrl)}` : ``}
|
|
144
204
|
Cloud Storage Uri = ${res.cloudStorageUri}
|
|
145
205
|
Size (KB) = ${Math.round(Number(res.size) / 1000)}
|
|
@@ -148,15 +208,16 @@ Privacy = ${res.privacy}
|
|
|
148
208
|
Render ID = ${res.renderId}
|
|
149
209
|
Codec = ${codec} (${codecReason})
|
|
150
210
|
`.trim()));
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
211
|
+
if (downloadName) {
|
|
212
|
+
log_1.Log.info('');
|
|
213
|
+
log_1.Log.info('downloading file...');
|
|
214
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
215
|
+
bucketName: res.bucketName,
|
|
216
|
+
gsutilURI: res.cloudStorageUri,
|
|
217
|
+
downloadName,
|
|
218
|
+
});
|
|
219
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
220
|
+
}
|
|
160
221
|
}
|
|
161
222
|
};
|
|
162
223
|
exports.renderCommand = renderCommand;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CloudRunPayloadType } from './payloads';
|
|
2
|
+
export declare const getCompositionFromBody: (body: CloudRunPayloadType) => Promise<import("remotion").VideoConfig>;
|
|
@@ -2,12 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCompositionFromBody = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const getCompositionFromBody = async (
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const getCompositionFromBody = async (body) => {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const { metadata, propsSize } = await renderer_1.RenderInternals.internalSelectComposition({
|
|
8
|
+
serveUrl: body.serveUrl,
|
|
9
|
+
browserExecutable: null,
|
|
10
|
+
chromiumOptions: (_a = body.chromiumOptions) !== null && _a !== void 0 ? _a : {},
|
|
11
|
+
envVariables: (_b = body.envVariables) !== null && _b !== void 0 ? _b : {},
|
|
12
|
+
id: body.composition,
|
|
13
|
+
indent: false,
|
|
14
|
+
inputProps: (_c = body.inputProps) !== null && _c !== void 0 ? _c : {},
|
|
15
|
+
logLevel: body.logLevel,
|
|
16
|
+
onBrowserLog: () => null,
|
|
17
|
+
port: null,
|
|
18
|
+
puppeteerInstance: undefined,
|
|
19
|
+
server: undefined,
|
|
20
|
+
timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
|
|
21
|
+
});
|
|
22
|
+
if (propsSize > 10000000) {
|
|
23
|
+
renderer_1.RenderInternals.Log.warn(`The props of your composition are large (${propsSize} bytes). This may cause slowdown.`);
|
|
10
24
|
}
|
|
11
|
-
|
|
25
|
+
return metadata;
|
|
12
26
|
};
|
|
13
27
|
exports.getCompositionFromBody = getCompositionFromBody;
|
|
@@ -221,12 +221,12 @@ declare const renderFailResponsePayload: z.ZodObject<{
|
|
|
221
221
|
stack: string;
|
|
222
222
|
}>;
|
|
223
223
|
declare const renderStillOnCloudrunResponsePayload: z.ZodObject<{
|
|
224
|
+
status: z.ZodLiteral<"success">;
|
|
224
225
|
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
225
226
|
cloudStorageUri: z.ZodString;
|
|
226
227
|
size: z.ZodNumber;
|
|
227
228
|
bucketName: z.ZodString;
|
|
228
229
|
renderId: z.ZodString;
|
|
229
|
-
status: z.ZodLiteral<"success">;
|
|
230
230
|
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
231
231
|
}, "strip", z.ZodTypeAny, {
|
|
232
232
|
bucketName: string;
|
|
@@ -246,12 +246,12 @@ declare const renderStillOnCloudrunResponsePayload: z.ZodObject<{
|
|
|
246
246
|
publicUrl?: string | null | undefined;
|
|
247
247
|
}>;
|
|
248
248
|
declare const renderMediaOnCloudrunResponsePayload: z.ZodObject<{
|
|
249
|
+
status: z.ZodLiteral<"success">;
|
|
249
250
|
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
250
251
|
cloudStorageUri: z.ZodString;
|
|
251
252
|
size: z.ZodNumber;
|
|
252
253
|
bucketName: z.ZodString;
|
|
253
254
|
renderId: z.ZodString;
|
|
254
|
-
status: z.ZodLiteral<"success">;
|
|
255
255
|
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
256
256
|
}, "strip", z.ZodTypeAny, {
|
|
257
257
|
bucketName: string;
|
|
@@ -270,8 +270,31 @@ declare const renderMediaOnCloudrunResponsePayload: z.ZodObject<{
|
|
|
270
270
|
renderId: string;
|
|
271
271
|
publicUrl?: string | null | undefined;
|
|
272
272
|
}>;
|
|
273
|
+
declare const cloudRunCrashResponse: z.ZodObject<{
|
|
274
|
+
status: z.ZodLiteral<"crash">;
|
|
275
|
+
cloudRunEndpoint: z.ZodString;
|
|
276
|
+
message: z.ZodLiteral<"Service crashed without sending a response. Check the logs in GCP console.">;
|
|
277
|
+
requestStartTime: z.ZodString;
|
|
278
|
+
requestCrashTime: z.ZodString;
|
|
279
|
+
requestElapsedTimeInSeconds: z.ZodNumber;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
message: "Service crashed without sending a response. Check the logs in GCP console.";
|
|
282
|
+
status: "crash";
|
|
283
|
+
cloudRunEndpoint: string;
|
|
284
|
+
requestStartTime: string;
|
|
285
|
+
requestCrashTime: string;
|
|
286
|
+
requestElapsedTimeInSeconds: number;
|
|
287
|
+
}, {
|
|
288
|
+
message: "Service crashed without sending a response. Check the logs in GCP console.";
|
|
289
|
+
status: "crash";
|
|
290
|
+
cloudRunEndpoint: string;
|
|
291
|
+
requestStartTime: string;
|
|
292
|
+
requestCrashTime: string;
|
|
293
|
+
requestElapsedTimeInSeconds: number;
|
|
294
|
+
}>;
|
|
273
295
|
export declare type CloudRunPayloadType = z.infer<typeof CloudRunPayload>;
|
|
274
296
|
export declare type RenderStillOnCloudrunOutput = z.infer<typeof renderStillOnCloudrunResponsePayload>;
|
|
275
297
|
export declare type RenderMediaOnCloudrunOutput = z.infer<typeof renderMediaOnCloudrunResponsePayload>;
|
|
276
298
|
export declare type ErrorResponsePayload = z.infer<typeof renderFailResponsePayload>;
|
|
299
|
+
export declare type CloudRunCrashResponse = z.infer<typeof cloudRunCrashResponse>;
|
|
277
300
|
export {};
|
|
@@ -77,20 +77,28 @@ const renderFailResponsePayload = zod_1.z.object({
|
|
|
77
77
|
stack: zod_1.z.string(),
|
|
78
78
|
});
|
|
79
79
|
const renderStillOnCloudrunResponsePayload = zod_1.z.object({
|
|
80
|
+
status: zod_1.z.literal('success'),
|
|
80
81
|
publicUrl: zod_1.z.string().optional().nullable(),
|
|
81
82
|
cloudStorageUri: zod_1.z.string(),
|
|
82
83
|
size: zod_1.z.number(),
|
|
83
84
|
bucketName: zod_1.z.string(),
|
|
84
85
|
renderId: zod_1.z.string(),
|
|
85
|
-
status: zod_1.z.literal('success'),
|
|
86
86
|
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
87
87
|
});
|
|
88
88
|
const renderMediaOnCloudrunResponsePayload = zod_1.z.object({
|
|
89
|
+
status: zod_1.z.literal('success'),
|
|
89
90
|
publicUrl: zod_1.z.string().optional().nullable(),
|
|
90
91
|
cloudStorageUri: zod_1.z.string(),
|
|
91
92
|
size: zod_1.z.number(),
|
|
92
93
|
bucketName: zod_1.z.string(),
|
|
93
94
|
renderId: zod_1.z.string(),
|
|
94
|
-
status: zod_1.z.literal('success'),
|
|
95
95
|
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
96
96
|
});
|
|
97
|
+
const cloudRunCrashResponse = zod_1.z.object({
|
|
98
|
+
status: zod_1.z.literal('crash'),
|
|
99
|
+
cloudRunEndpoint: zod_1.z.string(),
|
|
100
|
+
message: zod_1.z.literal('Service crashed without sending a response. Check the logs in GCP console.'),
|
|
101
|
+
requestStartTime: zod_1.z.string().datetime(),
|
|
102
|
+
requestCrashTime: zod_1.z.string().datetime(),
|
|
103
|
+
requestElapsedTimeInSeconds: zod_1.z.number(),
|
|
104
|
+
});
|
|
@@ -6,11 +6,11 @@ const renderer_1 = require("@remotion/renderer");
|
|
|
6
6
|
const random_hash_1 = require("../shared/random-hash");
|
|
7
7
|
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
8
8
|
const renderMediaSingleThread = async (body, res) => {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
10
|
if (body.type !== 'media') {
|
|
11
11
|
throw new Error('expected type media');
|
|
12
12
|
}
|
|
13
|
-
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body
|
|
13
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
|
|
14
14
|
const tempFilePath = '/tmp/output.mp4';
|
|
15
15
|
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
16
16
|
let previousProgress = 2;
|
|
@@ -56,7 +56,7 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
56
56
|
browserExecutable: null,
|
|
57
57
|
timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
|
|
58
58
|
cancelSignal: undefined,
|
|
59
|
-
concurrency: body.concurrency,
|
|
59
|
+
concurrency: (_f = body.concurrency) !== null && _f !== void 0 ? _f : '100%',
|
|
60
60
|
disallowParallelEncoding: false,
|
|
61
61
|
enforceAudioTrack: body.enforceAudioTrack,
|
|
62
62
|
ffmpegOverride: undefined,
|
|
@@ -76,7 +76,7 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
76
76
|
const uploadedResponse = await storage
|
|
77
77
|
.bucket(body.outputBucket)
|
|
78
78
|
.upload(tempFilePath, {
|
|
79
|
-
destination: `renders/${renderId}/${(
|
|
79
|
+
destination: `renders/${renderId}/${(_g = body.outName) !== null && _g !== void 0 ? _g : 'out.mp4'}`,
|
|
80
80
|
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
81
81
|
});
|
|
82
82
|
const uploadedFile = uploadedResponse[0];
|
|
@@ -12,7 +12,7 @@ const renderStillSingleThread = async (body, res) => {
|
|
|
12
12
|
throw new Error('expected type still');
|
|
13
13
|
}
|
|
14
14
|
log_1.Log.verbose('Rendering still frame', body);
|
|
15
|
-
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body
|
|
15
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
|
|
16
16
|
log_1.Log.verbose('Composition loaded', composition);
|
|
17
17
|
const tempFilePath = '/tmp/still.png';
|
|
18
18
|
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
@@ -13,7 +13,7 @@ const validateImageRemotionVersion = async () => {
|
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
const listedTags = await client.listTags({
|
|
16
|
-
parent: 'projects/remotion-dev/locations/us/repositories/
|
|
16
|
+
parent: 'projects/remotion-dev/locations/us/repositories/production/packages/render',
|
|
17
17
|
});
|
|
18
18
|
for (const tag of listedTags[0]) {
|
|
19
19
|
if (version_1.VERSION === ((_a = tag.name) === null || _a === void 0 ? void 0 : _a.split('/').pop())) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cloudrun",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-alpha7",
|
|
4
4
|
"description": "GCP Cloud Run alternative to lambda rendering",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
"@google-cloud/run": "^0.4.0",
|
|
10
10
|
"@google-cloud/storage": "^6.9.1",
|
|
11
11
|
"@google-cloud/resource-manager": "^4.3.0",
|
|
12
|
+
"@google-cloud/logging": "^10.5.0",
|
|
12
13
|
"google-auth-library": "^8.7.0",
|
|
13
14
|
"zod": "^3.21.4",
|
|
14
|
-
"@remotion/bundler": "4.1.0-
|
|
15
|
-
"@remotion/cli": "4.1.0-
|
|
16
|
-
"remotion": "4.1.0-
|
|
17
|
-
"
|
|
15
|
+
"@remotion/bundler": "4.1.0-alpha7",
|
|
16
|
+
"@remotion/cli": "4.1.0-alpha7",
|
|
17
|
+
"@remotion/renderer": "4.1.0-alpha7",
|
|
18
|
+
"remotion": "4.1.0-alpha7"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"ts-node": "^10.8.0",
|
|
27
28
|
"typescript": "4.7.2",
|
|
28
29
|
"vitest": "0.24.3",
|
|
29
|
-
"@remotion/compositor-linux-x64-gnu": "4.1.0-
|
|
30
|
+
"@remotion/compositor-linux-x64-gnu": "4.1.0-alpha7"
|
|
30
31
|
},
|
|
31
32
|
"exports": {
|
|
32
33
|
"./package.json": "./package.json",
|