🎥 Make videos programmatically with React
`@remotion/lambda`: Add `outKey` property to renderStillOnLambda() response
Jonny Burgerb775a661271e
diff --git a/packages/docs/docs/lambda/renderstillonlambda.md b/packages/docs/docs/lambda/renderstillonlambda.mdindex c65c6f9179..fbe44cdee6 100644--- a/packages/docs/docs/lambda/renderstillonlambda.md+++ b/packages/docs/docs/lambda/renderstillonlambda.md@@ -267,6 +267,10 @@ The S3 bucket in which the video was saved.An AWS S3 URL where the output is available.+### `outKey`<AvailableFrom v="4.0.141" />++The S3 key where the output is saved.+### `estimatedPrice`Object containing roughly estimated information about how expensive this operation was.diff --git a/packages/lambda-python/remotion_lambda/models.py b/packages/lambda-python/remotion_lambda/models.pyindex 804fbaccb5..0146ccbce4 100644--- a/packages/lambda-python/remotion_lambda/models.py+++ b/packages/lambda-python/remotion_lambda/models.py@@ -453,7 +453,7 @@ class RenderStillResponse:size_in_bytes: intbucket_name: strrender_id: str- cloud_watch_logs: Optional[str] = None+ outKey: strclass RenderMediaProgress:diff --git a/packages/lambda-python/remotion_lambda/remotionclient.py b/packages/lambda-python/remotion_lambda/remotionclient.pyindex 685d51f5c6..db2aa78ff2 100644--- a/packages/lambda-python/remotion_lambda/remotionclient.py+++ b/packages/lambda-python/remotion_lambda/remotionclient.py@@ -52,8 +52,10 @@ class RemotionClient:if len(payload) > max_inline_payload_size:raise ValueError((- f"InputProps are over {round(max_inline_payload_size / 1000)}KB "- f"({ceil(len(payload) / 1024)}KB) in size. This is not currently supported."+ f"InputProps are over {+ round(max_inline_payload_size / 1000)}KB "+ f"({ceil(len(payload) / 1024)+ }KB) in size. This is not currently supported."))@@ -217,10 +219,10 @@ class RemotionClient:disclaimer=body_object['estimatedPrice']['disclaimer']),url=body_object['output'],- size_in_bytes=body_object['size'],+ size_in_bytes=body_object['sizeInBytes'],bucket_name=body_object['bucketName'],render_id=body_object['renderId'],- # cloud_watch_logs=body_object['cloud_watch_logs']+ outKey=body_object['outKey'],)return Nonediff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex b89e2b222d..2235d236fc 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -51,6 +51,7 @@ export type RenderStillOnLambdaInput = {export type RenderStillOnLambdaOutput = {estimatedPrice: CostsInfo;url: string;+ outKey: string;sizeInBytes: number;bucketName: string;renderId: string;@@ -92,6 +93,7 @@ const renderStillOnLambdaRaw = async (return {estimatedPrice: res.estimatedPrice,url: res.output,+ outKey: res.outKey,sizeInBytes: res.size,bucketName: res.bucketName,renderId: res.renderId,diff --git a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.tsindex 26040f6421..b95fa214d7 100644--- a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts+++ b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts@@ -46,7 +46,7 @@ export const findOutputFileInBucket = async ({renderMetadata,bucketName,customCredentials,- ),+ ).url,};} catch (err) {if ((err as Error).name === 'NotFound') {diff --git a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.tsindex bc9b7ea7f6..58e6fe1260 100644--- a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts+++ b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts@@ -8,12 +8,13 @@ export const getOutputUrlFromMetadata = (bucketName: string,customCredentials: CustomCredentials | null,) => {- const outname = getExpectedOutName(+ const {key, renderBucketName} = getExpectedOutName(renderMetadata,bucketName,customCredentials,);- return `https://s3.${getCurrentRegionInFunction()}.amazonaws.com/${- outname.renderBucketName- }/${outname.key}`;+ return {+ url: `https://s3.${getCurrentRegionInFunction()}.amazonaws.com/${renderBucketName}/${key}`,+ key,+ };};diff --git a/packages/lambda/src/functions/helpers/merge-chunks.ts b/packages/lambda/src/functions/helpers/merge-chunks.tsindex 4cff8c0759..f57cb02086 100644--- a/packages/lambda/src/functions/helpers/merge-chunks.ts+++ b/packages/lambda/src/functions/helpers/merge-chunks.ts@@ -270,7 +270,7 @@ export const mergeChunksAndFinishRender = async (options: {serialized: options.serializedResolvedProps,});- const outputUrl = getOutputUrlFromMetadata(+ const {url: outputUrl} = getOutputUrlFromMetadata(options.renderMetadata,options.bucketName,options.customCredentials,diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.tsindex 9892ba34f6..2608efedb6 100644--- a/packages/lambda/src/functions/still.ts+++ b/packages/lambda/src/functions/still.ts@@ -265,23 +265,27 @@ const innerStillHandler = async ({diskSizeInMb: MAX_EPHEMERAL_STORAGE_IN_MB,});+ const {key: outKey, url} = getOutputUrlFromMetadata(+ renderMetadata,+ bucketName,+ customCredentials,+ );+return {type: 'success' as const,- output: getOutputUrlFromMetadata(- renderMetadata,- bucketName,- customCredentials,- ),+ output: url,size,bucketName,estimatedPrice: formatCostsInfo(estimatedPrice),renderId,+ outKey,};};type RenderStillLambdaResponsePayload = {type: 'success';output: string;+ outKey: string;size: number;bucketName: string;estimatedPrice: CostsInfo;