@remotion/cloudrun 4.1.0-alpha5 → 4.1.0-alpha8

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.
@@ -1,13 +1,13 @@
1
1
 
2
- > @remotion/cloudrun@3.3.101 build /Users/jonathanburger/remotion-v4/packages/cloudrun
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-v4/packages/cloudrun
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-v4/packages/cloudrun
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/cloud-run/render:${version_1.VERSION}`,
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 1 (one open browser tab). You may use the option to customize this value.
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>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderMediaOnCloudrun = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
+ const remotion_1 = require("remotion");
5
6
  const validate_gcp_codec_1 = require("../shared/validate-gcp-codec");
6
7
  const validate_privacy_1 = require("../shared/validate-privacy");
7
8
  const validate_serveurl_1 = require("../shared/validate-serveurl");
@@ -41,7 +42,7 @@ const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
41
42
  * @param params.forceHeight Overrides default composition height.
42
43
  * @param params.logLevel Level of logging that Cloud Run service should perform. Default "info".
43
44
  * @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 1 (one open browser tab). You may use the option to customize this value.
45
+ * @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
46
  * @param params.enforceAudioTrack Render a silent audio track if there wouldn't be any otherwise.
46
47
  * @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
48
  * @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
@@ -61,7 +62,11 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
61
62
  composition,
62
63
  serveUrl,
63
64
  codec: actualCodec,
64
- inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
65
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
66
+ indent: undefined,
67
+ staticBase: null,
68
+ data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
69
+ }).serializedString,
65
70
  jpegQuality: jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
66
71
  audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
67
72
  audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
@@ -99,6 +104,8 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
99
104
  const renderResponse = await new Promise((resolve, reject) => {
100
105
  // TODO: Add any sort of type safety
101
106
  let response;
107
+ const startTime = Date.now();
108
+ const formattedStartTime = new Date().toISOString();
102
109
  const stream = postResponse.data;
103
110
  stream.on('data', (chunk) => {
104
111
  const chunkResponse = JSON.parse(chunk.toString());
@@ -110,7 +117,20 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
110
117
  }
111
118
  });
112
119
  stream.on('end', () => {
113
- if (response.status !== 'success') {
120
+ if (!response) {
121
+ const crashTime = Date.now();
122
+ const formattedCrashTime = new Date().toISOString();
123
+ updateRenderProgress === null || updateRenderProgress === void 0 ? void 0 : updateRenderProgress(0, true);
124
+ resolve({
125
+ status: 'crash',
126
+ cloudRunEndpoint,
127
+ message: 'Service crashed without sending a response. Check the logs in GCP console.',
128
+ requestStartTime: formattedStartTime,
129
+ requestCrashTime: formattedCrashTime,
130
+ requestElapsedTimeInSeconds: (crashTime - startTime) / 1000,
131
+ });
132
+ }
133
+ else if (response.status !== 'success' && response.status !== 'crash') {
114
134
  throw new Error(response.stack);
115
135
  }
116
136
  resolve(response);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderStillOnCloudrun = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
+ const remotion_1 = require("remotion");
5
6
  const validate_privacy_1 = require("../shared/validate-privacy");
6
7
  const validate_serveurl_1 = require("../shared/validate-serveurl");
7
8
  const get_or_create_bucket_1 = require("./get-or-create-bucket");
@@ -44,7 +45,11 @@ const renderStillOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
44
45
  const data = {
45
46
  composition,
46
47
  serveUrl,
47
- inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
48
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
49
+ indent: undefined,
50
+ staticBase: null,
51
+ data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
52
+ }).serializedString,
48
53
  outputBucket,
49
54
  outName,
50
55
  privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
@@ -6,7 +6,11 @@ const render_media_on_cloudrun_1 = require("../../../api/render-media-on-cloudru
6
6
  // import {validateMaxRetries} from '../../../shared/validate-retries';
7
7
  const config_1 = require("@remotion/cli/config");
8
8
  const renderer_1 = require("@remotion/renderer");
9
+ const remotion_1 = require("remotion");
9
10
  const download_file_1 = require("../../../api/download-file");
11
+ const extract_mem_from_url_1 = require("../../../api/helpers/extract-mem-from-url");
12
+ const extract_time_from_url_1 = require("../../../api/helpers/extract-time-from-url");
13
+ const get_cloud_logging_client_1 = require("../../../api/helpers/get-cloud-logging-client");
10
14
  const validate_serveurl_1 = require("../../../shared/validate-serveurl");
11
15
  const args_1 = require("../../args");
12
16
  const log_1 = require("../../log");
@@ -49,7 +53,6 @@ const renderCommand = async (args, remotionRoot) => {
49
53
  envVariables,
50
54
  height,
51
55
  indent: false,
52
- inputProps,
53
56
  port,
54
57
  puppeteerInstance: undefined,
55
58
  serveUrlOrWebpackUrl: serveUrl,
@@ -57,6 +60,11 @@ const renderCommand = async (args, remotionRoot) => {
57
60
  logLevel,
58
61
  width,
59
62
  server: await server,
63
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
64
+ data: inputProps,
65
+ indent: undefined,
66
+ staticBase: null,
67
+ }).serializedString,
60
68
  });
61
69
  composition = compositionId;
62
70
  }
@@ -94,9 +102,17 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
94
102
  : cli_1.CliInternals.chalk.gray(`${renderProgress.doneIn}ms`),
95
103
  ].join(' '), false);
96
104
  };
97
- const updateRenderProgress = (progress) => {
98
- renderProgress.progress = progress;
99
- updateProgress();
105
+ const updateRenderProgress = (progress, error) => {
106
+ if (error) {
107
+ // exiting progress and adding space
108
+ log_1.Log.info(`
109
+
110
+ `);
111
+ }
112
+ else {
113
+ renderProgress.progress = progress;
114
+ updateProgress();
115
+ }
100
116
  };
101
117
  const res = await (0, render_media_on_cloudrun_1.renderMediaOnCloudrun)({
102
118
  cloudRunUrl,
@@ -134,12 +150,61 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
134
150
  enforceAudioTrack,
135
151
  preferLossless: false,
136
152
  });
137
- renderProgress.doneIn = Date.now() - renderStart;
138
- updateProgress();
139
- log_1.Log.info(`
153
+ if (res.status === 'crash') {
154
+ let timeoutPreMsg = '';
155
+ const timeout = (0, extract_time_from_url_1.extractTimeoutFromURL)(res.cloudRunEndpoint);
156
+ const memoryLimit = (0, extract_mem_from_url_1.extractMemoryFromURL)(res.cloudRunEndpoint);
157
+ if (timeout && res.requestElapsedTimeInSeconds + 10 > timeout) {
158
+ timeoutPreMsg = `Render call likely timed out. Service timeout is ${timeout} seconds, and render took at least ${res.requestElapsedTimeInSeconds.toFixed(1)} seconds.\n`;
159
+ }
160
+ else {
161
+ timeoutPreMsg = `Crash unlikely due to timeout. Render took ${res.requestElapsedTimeInSeconds.toFixed(1)} seconds, below the timeout of ${timeout} seconds.\n`;
162
+ }
163
+ log_1.Log.error(`Error rendering on Cloud Run. The Cloud Run service did not return a response.\n
164
+ ${timeoutPreMsg}The crash may be due to the service exceeding its memory limit of ${memoryLimit}.
165
+ Full logs are available at https://console.cloud.google.com/run?project=${process.env.REMOTION_GCP_PROJECT_ID}\n`);
166
+ const cloudLoggingClient = (0, get_cloud_logging_client_1.getCloudLoggingClient)();
167
+ const listLogEntriesRequest = {
168
+ resourceNames: [`projects/${process.env.REMOTION_GCP_PROJECT_ID}`],
169
+ 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}"`,
170
+ };
171
+ const logCheckCountdown = cli_1.CliInternals.createOverwriteableCliOutput({
172
+ quiet: cli_1.CliInternals.quietFlagProvided(),
173
+ cancelSignal: null,
174
+ updatesDontOverwrite: false,
175
+ indent: false,
176
+ });
177
+ await (() => {
178
+ return new Promise((resolve) => {
179
+ let timeLeft = 30;
180
+ const intervalId = setInterval(() => {
181
+ logCheckCountdown.update(`GCP Cloud Logging takes time to ingest and index logs.\nFetching recent error/warning logs in ${timeLeft} seconds`, false);
182
+ timeLeft--;
183
+ if (timeLeft < 0) {
184
+ logCheckCountdown.update('Fetching logs...\n\n', false);
185
+ clearInterval(intervalId);
186
+ resolve();
187
+ }
188
+ }, 1000);
189
+ });
190
+ })();
191
+ const iterableLogListEntries = await cloudLoggingClient.listLogEntriesAsync(listLogEntriesRequest);
192
+ for await (const logResponse of iterableLogListEntries) {
193
+ const responseDate = new Date(Number(logResponse.timestamp.seconds) * 1000 +
194
+ Number(logResponse.timestamp.nanos) / 1000000);
195
+ const convertedDate = responseDate.toLocaleString();
196
+ log_1.Log.info(convertedDate);
197
+ log_1.Log.info(logResponse.textPayload);
198
+ log_1.Log.info();
199
+ }
200
+ }
201
+ else if (res.status === 'success') {
202
+ renderProgress.doneIn = Date.now() - renderStart;
203
+ updateProgress();
204
+ log_1.Log.info(`
140
205
 
141
206
  `);
142
- log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
207
+ log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
143
208
  ${res.publicUrl ? `Public URL = ${decodeURIComponent(res.publicUrl)}` : ``}
144
209
  Cloud Storage Uri = ${res.cloudStorageUri}
145
210
  Size (KB) = ${Math.round(Number(res.size) / 1000)}
@@ -148,15 +213,16 @@ Privacy = ${res.privacy}
148
213
  Render ID = ${res.renderId}
149
214
  Codec = ${codec} (${codecReason})
150
215
  `.trim()));
151
- if (downloadName) {
152
- log_1.Log.info('');
153
- log_1.Log.info('downloading file...');
154
- const destination = await (0, download_file_1.downloadFile)({
155
- bucketName: res.bucketName,
156
- gsutilURI: res.cloudStorageUri,
157
- downloadName,
158
- });
159
- log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
216
+ if (downloadName) {
217
+ log_1.Log.info('');
218
+ log_1.Log.info('downloading file...');
219
+ const destination = await (0, download_file_1.downloadFile)({
220
+ bucketName: res.bucketName,
221
+ gsutilURI: res.cloudStorageUri,
222
+ downloadName,
223
+ });
224
+ log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
225
+ }
160
226
  }
161
227
  };
162
228
  exports.renderCommand = renderCommand;
@@ -4,6 +4,7 @@ exports.stillCommand = exports.STILL_COMMAND = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const config_1 = require("@remotion/cli/config");
6
6
  const renderer_1 = require("@remotion/renderer");
7
+ const remotion_1 = require("remotion");
7
8
  const download_file_1 = require("../../api/download-file");
8
9
  const render_still_on_cloudrun_1 = require("../../api/render-still-on-cloudrun");
9
10
  const validate_serveurl_1 = require("../../shared/validate-serveurl");
@@ -39,7 +40,11 @@ const stillCommand = async (args, remotionRoot) => {
39
40
  browserExecutable,
40
41
  chromiumOptions,
41
42
  envVariables,
42
- inputProps,
43
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
44
+ data: inputProps,
45
+ indent: undefined,
46
+ staticBase: null,
47
+ }).serializedString,
43
48
  port,
44
49
  puppeteerInstance: undefined,
45
50
  timeoutInMilliseconds: puppeteerTimeout,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCompositionFromBody = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const getCompositionFromBody = async (body) => {
6
- var _a, _b, _c;
6
+ var _a, _b;
7
7
  const { metadata, propsSize } = await renderer_1.RenderInternals.internalSelectComposition({
8
8
  serveUrl: body.serveUrl,
9
9
  browserExecutable: null,
@@ -11,7 +11,7 @@ const getCompositionFromBody = async (body) => {
11
11
  envVariables: (_b = body.envVariables) !== null && _b !== void 0 ? _b : {},
12
12
  id: body.composition,
13
13
  indent: false,
14
- inputProps: (_c = body.inputProps) !== null && _c !== void 0 ? _c : {},
14
+ serializedInputPropsWithCustomSchema: body.serializedInputPropsWithCustomSchema,
15
15
  logLevel: body.logLevel,
16
16
  onBrowserLog: () => null,
17
17
  port: null,
@@ -6,7 +6,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
6
6
  forceHeight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
7
  forceWidth: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
8
  codec: z.ZodEnum<["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"]>;
9
- inputProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9
+ serializedInputPropsWithCustomSchema: z.ZodString;
10
10
  jpegQuality: z.ZodNumber;
11
11
  audioCodec: z.ZodNullable<z.ZodEnum<["pcm-16", "aac", "mp3", "opus"]>>;
12
12
  audioBitrate: z.ZodNullable<z.ZodString>;
@@ -49,11 +49,11 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
49
49
  enforceAudioTrack: z.ZodBoolean;
50
50
  preferLossless: z.ZodBoolean;
51
51
  }, "strip", z.ZodTypeAny, {
52
- serveUrl: string;
53
52
  type: "media";
53
+ serveUrl: string;
54
54
  composition: string;
55
55
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
56
- inputProps: Record<string, unknown>;
56
+ serializedInputPropsWithCustomSchema: string;
57
57
  jpegQuality: number;
58
58
  audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
59
59
  audioBitrate: string | null;
@@ -86,11 +86,11 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
86
86
  outName?: string | undefined;
87
87
  privacy?: "public" | "private" | undefined;
88
88
  }, {
89
- serveUrl: string;
90
89
  type: "media";
90
+ serveUrl: string;
91
91
  composition: string;
92
92
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
93
- inputProps: Record<string, unknown>;
93
+ serializedInputPropsWithCustomSchema: string;
94
94
  jpegQuality: number;
95
95
  audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
96
96
  audioBitrate: string | null;
@@ -128,7 +128,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
128
128
  composition: z.ZodString;
129
129
  forceHeight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
130
130
  forceWidth: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
131
- inputProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
131
+ serializedInputPropsWithCustomSchema: z.ZodString;
132
132
  jpegQuality: z.ZodOptional<z.ZodNumber>;
133
133
  imageFormat: z.ZodEnum<["png", "jpeg", "pdf", "webp"]>;
134
134
  scale: z.ZodNumber;
@@ -159,10 +159,10 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
159
159
  delayRenderTimeoutInMilliseconds: z.ZodNumber;
160
160
  logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
161
161
  }, "strip", z.ZodTypeAny, {
162
- serveUrl: string;
163
162
  type: "still";
163
+ serveUrl: string;
164
164
  composition: string;
165
- inputProps: Record<string, unknown>;
165
+ serializedInputPropsWithCustomSchema: string;
166
166
  imageFormat: "png" | "jpeg" | "pdf" | "webp";
167
167
  scale: number;
168
168
  envVariables: Record<string, string>;
@@ -183,10 +183,10 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
183
183
  } | undefined;
184
184
  outName?: string | undefined;
185
185
  }, {
186
- serveUrl: string;
187
186
  type: "still";
187
+ serveUrl: string;
188
188
  composition: string;
189
- inputProps: Record<string, unknown>;
189
+ serializedInputPropsWithCustomSchema: string;
190
190
  imageFormat: "png" | "jpeg" | "pdf" | "webp";
191
191
  scale: number;
192
192
  envVariables: Record<string, string>;
@@ -212,66 +212,89 @@ declare const renderFailResponsePayload: z.ZodObject<{
212
212
  error: z.ZodString;
213
213
  stack: z.ZodString;
214
214
  }, "strip", z.ZodTypeAny, {
215
- error: string;
216
215
  status: "error";
216
+ error: string;
217
217
  stack: string;
218
218
  }, {
219
- error: string;
220
219
  status: "error";
220
+ error: string;
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
- bucketName: string;
233
- size: number;
234
232
  status: "success";
235
233
  privacy: "public-read" | "project-private";
236
234
  cloudStorageUri: string;
235
+ size: number;
236
+ bucketName: string;
237
237
  renderId: string;
238
238
  publicUrl?: string | null | undefined;
239
239
  }, {
240
- bucketName: string;
241
- size: number;
242
240
  status: "success";
243
241
  privacy: "public-read" | "project-private";
244
242
  cloudStorageUri: string;
243
+ size: number;
244
+ bucketName: string;
245
245
  renderId: string;
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
- bucketName: string;
258
- size: number;
259
257
  status: "success";
260
258
  privacy: "public-read" | "project-private";
261
259
  cloudStorageUri: string;
260
+ size: number;
261
+ bucketName: string;
262
262
  renderId: string;
263
263
  publicUrl?: string | null | undefined;
264
264
  }, {
265
- bucketName: string;
266
- size: number;
267
265
  status: "success";
268
266
  privacy: "public-read" | "project-private";
269
267
  cloudStorageUri: string;
268
+ size: number;
269
+ bucketName: string;
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 {};
@@ -26,7 +26,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
26
26
  forceHeight: zod_1.z.number().optional().nullable(),
27
27
  forceWidth: zod_1.z.number().optional().nullable(),
28
28
  codec,
29
- inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
29
+ serializedInputPropsWithCustomSchema: zod_1.z.string(),
30
30
  jpegQuality: zod_1.z.number(),
31
31
  audioCodec: audioCodec.nullable(),
32
32
  audioBitrate: zod_1.z.string().nullable(),
@@ -57,7 +57,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
57
57
  composition: zod_1.z.string(),
58
58
  forceHeight: zod_1.z.number().optional().nullable(),
59
59
  forceWidth: zod_1.z.number().optional().nullable(),
60
- inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
60
+ serializedInputPropsWithCustomSchema: zod_1.z.string(),
61
61
  jpegQuality: zod_1.z.number().optional(),
62
62
  imageFormat: stillImageFormat,
63
63
  scale: zod_1.z.number(),
@@ -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
+ });
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderMediaSingleThread = void 0;
4
4
  const storage_1 = require("@google-cloud/storage");
5
5
  const renderer_1 = require("@remotion/renderer");
6
+ const remotion_1 = require("remotion");
6
7
  const random_hash_1 = require("../shared/random-hash");
7
8
  const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
8
9
  const renderMediaSingleThread = async (body, res) => {
9
- var _a, _b, _c, _d, _e, _f;
10
+ var _a, _b, _c, _d, _e, _f, _g;
10
11
  if (body.type !== 'media') {
11
12
  throw new Error('expected type media');
12
13
  }
@@ -35,7 +36,12 @@ const renderMediaSingleThread = async (body, res) => {
35
36
  serveUrl: body.serveUrl,
36
37
  codec: body.codec,
37
38
  outputLocation: tempFilePath,
38
- inputProps: body.inputProps,
39
+ serializedInputPropsWithCustomSchema: body.serializedInputPropsWithCustomSchema,
40
+ serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
41
+ data: composition.props,
42
+ indent: undefined,
43
+ staticBase: null,
44
+ }).serializedString,
39
45
  jpegQuality: body.jpegQuality,
40
46
  audioCodec: body.audioCodec,
41
47
  audioBitrate: body.audioBitrate,
@@ -56,7 +62,7 @@ const renderMediaSingleThread = async (body, res) => {
56
62
  browserExecutable: null,
57
63
  timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
58
64
  cancelSignal: undefined,
59
- concurrency: body.concurrency,
65
+ concurrency: (_f = body.concurrency) !== null && _f !== void 0 ? _f : '100%',
60
66
  disallowParallelEncoding: false,
61
67
  enforceAudioTrack: body.enforceAudioTrack,
62
68
  ffmpegOverride: undefined,
@@ -76,7 +82,7 @@ const renderMediaSingleThread = async (body, res) => {
76
82
  const uploadedResponse = await storage
77
83
  .bucket(body.outputBucket)
78
84
  .upload(tempFilePath, {
79
- destination: `renders/${renderId}/${(_f = body.outName) !== null && _f !== void 0 ? _f : 'out.mp4'}`,
85
+ destination: `renders/${renderId}/${(_g = body.outName) !== null && _g !== void 0 ? _g : 'out.mp4'}`,
80
86
  predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
81
87
  });
82
88
  const uploadedFile = uploadedResponse[0];