Skip to content

🎥 Make videos programmatically with React

Update renderMediaOnLambda()

Pramod2f506a51c4a8
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.mdx b/packages/docs/docs/lambda/rendermediaonlambda.mdx
index 4f67962faf..95bbdf802d 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.mdx
+++ b/packages/docs/docs/lambda/rendermediaonlambda.mdx
@@ -337,14 +337,18 @@ If the `logLevel` is set to `verbose`, the Lambda function will not clean up art
Passes `forcePathStyle` to the AWS S3 client. If you don't know what this is, you probably don't need it.
-### `apiKey?`<AvailableFrom v="4.0.253"/>
-
-<Options id="api-key" />
-
### `storageClass?`<AvailableFrom v="4.0.305"/>
An [identifier](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html#sc-compare) for the S3 storage class of the rendered media. Default: `undefined` (which is `STANDARD`).
+### `licenseKey?`<AvailableFrom v="4.0.999"/>
+
+<Options id="license-key" />
+
+### ~~`apiKey?`<AvailableFrom v="4.0.253"/>~~
+
+<Options id="api-key" />
+
### ~~`dumpBrowserLogs?`~~
Deprecated in v4.0 in favor of [`logLevel`](#loglevel).
diff --git a/packages/lambda-client/src/make-lambda-payload.ts b/packages/lambda-client/src/make-lambda-payload.ts
index ddb73688ff..ea2eb3264b 100644
--- a/packages/lambda-client/src/make-lambda-payload.ts
+++ b/packages/lambda-client/src/make-lambda-payload.ts
@@ -88,7 +88,9 @@ export type InnerRenderMediaOnLambdaInput = {
metadata: Record<string, string> | null;
storageClass: StorageClass | null;
requestHandler: RequestHandler | null;
-} & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
+} & ToOptions<
+ Omit<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda, 'apiKey'>
+>;
export const makeLambdaRenderMediaPayload = async ({
rendererFunctionName,
@@ -136,7 +138,6 @@ export const makeLambdaRenderMediaPayload = async ({
preferLossless,
forcePathStyle,
metadata,
- apiKey,
licenseKey,
offthreadVideoThreads,
storageClass,
diff --git a/packages/lambda-client/src/render-media-on-lambda.ts b/packages/lambda-client/src/render-media-on-lambda.ts
index 50eac45c72..e2bf868fc4 100644
--- a/packages/lambda-client/src/render-media-on-lambda.ts
+++ b/packages/lambda-client/src/render-media-on-lambda.ts
@@ -74,7 +74,16 @@ export type RenderMediaOnLambdaInput = {
metadata?: Record<string, string> | null;
storageClass?: StorageClass | null;
requestHandler?: RequestHandler;
-} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
+} & {
+ /**
+ * @deprecated Use `licenseKey` instead
+ */
+ apiKey?: string | null;
+} & Partial<
+ ToOptions<
+ Omit<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda, 'apiKey'>
+ >
+ >;
export type RenderMediaOnLambdaOutput = {
renderId: string;
@@ -196,8 +205,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
forcePathStyle: options.forcePathStyle ?? false,
indent: false,
metadata: options.metadata ?? null,
- apiKey: options.apiKey ?? null,
- licenseKey: options.licenseKey ?? null,
+ licenseKey: options.apiKey ?? options.licenseKey ?? null,
storageClass: options.storageClass ?? null,
requestHandler: options.requestHandler ?? null,
mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index eb4eaeb17f..0196ed682e 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -1084,7 +1084,7 @@ export const renderMedia = ({
hardwareAcceleration: hardwareAcceleration ?? 'disable',
chromeMode: chromeMode ?? 'headless-shell',
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
- licenseKey: licenseKey ?? apiKey ?? null,
+ licenseKey: apiKey ?? licenseKey ?? null,
onLog: defaultOnLog,
});
};
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index ed2aac8498..a42ea76155 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -108,8 +108,12 @@ export type RenderStillOptions = {
*/
quality?: never;
onArtifact?: OnArtifact;
- // TODO: Make apiKey deprecated with TS
-} & Partial<ToOptions<typeof optionsMap.renderStill>>;
+} & {
+ /**
+ * @deprecated Use `licenseKey` instead
+ */
+ apiKey?: string | null;
+} & Partial<ToOptions<Omit<typeof optionsMap.renderStill, 'apiKey'>>>;
type CleanupFn = () => Promise<unknown>;
type RenderStillReturnValue = {buffer: Buffer | null};