🎥 Make videos programmatically with React
return cloudwatch URL when rendering using renderStillOnLambda() and renderMediaOnLambda()
Jonny Burgere15fd60ad818
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.mdindex 818ec49073..3a855d663a 100644--- a/packages/docs/docs/lambda/rendermediaonlambda.md+++ b/packages/docs/docs/lambda/rendermediaonlambda.md@@ -208,7 +208,7 @@ The default for Lambda is `swangle`, but `null` elsewhere.## Return value-Returns a promise resolving to an object containing two properties: `renderId` and `bucketName`. Those are useful for passing to `getRenderProgress()`+Returns a promise resolving to an object containing two properties: `renderId`, `bucketName`, `cloudWatchLogs`. Those are useful for passing to `getRenderProgress()`### `renderId`@@ -218,6 +218,12 @@ A unique alphanumeric identifier for this render. Useful for obtaining status anThe S3 bucket name in which all files are being saved.+### `cloudWatchLogs`++_Available from v3.2.10_++A link to CloudWatch (if you haven't disabled it) that you can visit to see the logs for the render.+## See also- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/render-media-on-lambda.ts)diff --git a/packages/docs/docs/lambda/renderstillonlambda.md b/packages/docs/docs/lambda/renderstillonlambda.mdindex aa891115aa..c0cf0c5bc9 100644--- a/packages/docs/docs/lambda/renderstillonlambda.md+++ b/packages/docs/docs/lambda/renderstillonlambda.md@@ -185,6 +185,12 @@ The size of the output image in bytes.A unique alphanumeric identifier for this render. Useful for obtaining status and finding the relevant files in the S3 bucket.+### `cloudWatchLogs`++_Available from v3.2.10_++A link to CloudWatch (if you haven't disabled it) that you can visit to see the logs for the render.+## See also- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/render-still-on-lambda.ts)diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.tsindex 62bd498a77..a54aee123a 100644--- a/packages/lambda/src/api/render-media-on-lambda.ts+++ b/packages/lambda/src/api/render-media-on-lambda.ts@@ -13,6 +13,7 @@ import type {OutNameInput, Privacy} from '../shared/constants';import {LambdaRoutines} from '../shared/constants';import type {DownloadBehavior} from '../shared/content-disposition-header';import {convertToServeUrl} from '../shared/convert-to-serve-url';+import {getCloudwatchStreamUrl} from '../shared/get-cloudwatch-stream-url';import {validateDownloadBehavior} from '../shared/validate-download-behavior';import {validateFramesPerLambda} from '../shared/validate-frames-per-lambda';import type {LambdaCodec} from '../shared/validate-lambda-codec';@@ -51,6 +52,7 @@ export type RenderMediaOnLambdaInput = {export type RenderMediaOnLambdaOutput = {renderId: string;bucketName: string;+ cloudWatchLogs: string;};/**@@ -141,6 +143,12 @@ export const renderMediaOnLambda = async ({return {renderId: res.renderId,bucketName: res.bucketName,+ cloudWatchLogs: getCloudwatchStreamUrl({+ functionName,+ method: LambdaRoutines.renderer,+ region,+ renderId: res.renderId,+ }),};} catch (err) {if ((err as Error).stack?.includes('UnrecognizedClientException')) {diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex 6e86316834..dc9266d4b9 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -10,6 +10,7 @@ import type {CostsInfo, OutNameInput, Privacy} from '../shared/constants';import {DEFAULT_MAX_RETRIES, LambdaRoutines} from '../shared/constants';import type {DownloadBehavior} from '../shared/content-disposition-header';import {convertToServeUrl} from '../shared/convert-to-serve-url';+import {getCloudwatchStreamUrl} from '../shared/get-cloudwatch-stream-url';export type RenderStillOnLambdaInput = {region: AwsRegion;@@ -37,6 +38,7 @@ export type RenderStillOnLambdaOutput = {sizeInBytes: number;bucketName: string;renderId: string;+ cloudWatchLogs: string;};/**@@ -107,6 +109,12 @@ export const renderStillOnLambda = async ({sizeInBytes: res.size,bucketName: res.bucketName,renderId: res.renderId,+ cloudWatchLogs: getCloudwatchStreamUrl({+ functionName,+ method: LambdaRoutines.still,+ region,+ renderId: res.renderId,+ }),};} catch (err) {if ((err as Error).stack?.includes('UnrecognizedClientException')) {diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.tsindex 57e377e82c..8714940269 100644--- a/packages/lambda/src/cli/commands/render/render.ts+++ b/packages/lambda/src/cli/commands/render/render.ts@@ -7,7 +7,6 @@ import {BINARY_NAME,DEFAULT_MAX_RETRIES,DEFAULT_OUTPUT_PRIVACY,- LambdaRoutines,} from '../../../shared/constants';import {sleep} from '../../../shared/sleep';import {validateFramesPerLambda} from '../../../shared/validate-frames-per-lambda';@@ -17,7 +16,6 @@ import {validateMaxRetries} from '../../../shared/validate-retries';import {parsedLambdaCli} from '../../args';import {getAwsRegion} from '../../get-aws-region';import {findFunctionName} from '../../helpers/find-function-name';-import {getCloudwatchStreamUrl} from '../../helpers/get-cloudwatch-stream-url';import {quit} from '../../helpers/quit';import {Log} from '../../log';import {makeMultiProgressFromStatus, makeProgressString} from './progress';@@ -124,14 +122,7 @@ export const renderCommand = async (args: string[]) => {`Bucket = ${res.bucketName}, renderId = ${res.renderId}, functionName = ${functionName}`));- Log.verbose(- `CloudWatch logs (if enabled): ${getCloudwatchStreamUrl({- functionName,- region,- renderId: res.renderId,- method: LambdaRoutines.renderer,- })}`- );+ Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);const status = await getRenderProgress({functionName,bucketName: res.bucketName,diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.tsindex e8de0bbded..24ead942f1 100644--- a/packages/lambda/src/cli/commands/still.ts+++ b/packages/lambda/src/cli/commands/still.ts@@ -7,14 +7,12 @@ import {BINARY_NAME,DEFAULT_MAX_RETRIES,DEFAULT_OUTPUT_PRIVACY,- LambdaRoutines,} from '../../shared/constants';import {validatePrivacy} from '../../shared/validate-privacy';import {validateMaxRetries} from '../../shared/validate-retries';import {parsedLambdaCli} from '../args';import {getAwsRegion} from '../get-aws-region';import {findFunctionName} from '../helpers/find-function-name';-import {getCloudwatchStreamUrl} from '../helpers/get-cloudwatch-stream-url';import {quit} from '../helpers/quit';import {Log} from '../log';@@ -95,14 +93,7 @@ export const stillCommand = async (args: string[]) => {`Bucket = ${res.bucketName}, renderId = ${res.renderId}, functionName = ${functionName}`));- Log.verbose(- `CloudWatch logs (if enabled): ${getCloudwatchStreamUrl({- functionName,- region: getAwsRegion(),- renderId: res.renderId,- method: LambdaRoutines.still,- })}`- );+ Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);if (outName) {Log.info('Finished rendering. Downloading...');diff --git a/packages/lambda/src/cli/helpers/get-cloudwatch-stream-url.ts b/packages/lambda/src/shared/get-cloudwatch-stream-url.tssimilarity index 80%rename from packages/lambda/src/cli/helpers/get-cloudwatch-stream-url.tsrename to packages/lambda/src/shared/get-cloudwatch-stream-url.tsindex f853e346bf..fafcf3509f 100644--- a/packages/lambda/src/cli/helpers/get-cloudwatch-stream-url.ts+++ b/packages/lambda/src/shared/get-cloudwatch-stream-url.ts@@ -1,5 +1,5 @@-import type {AwsRegion} from '../../client';-import type {LambdaRoutines} from '../../shared/constants';+import type {AwsRegion} from '../client';+import type {LambdaRoutines} from './constants';export const getCloudwatchStreamUrl = ({region,